Parallelism operators

Urbiscript provides four parallelism operators, which enable programmer to schedule tasks and synchronize different robot tasks. Operators are:

urbi ser

 

urbi paral

The following listing presents differences between separators.

//; vs &
function test(name)
{
echo(name + ":1");
echo(name + ":2");
echo(name + ":3");
}|{};
//serialized execution
test("left");test("middle");test("right");
//prints: left:1 left:2 left:3 middle:1 middle:2 middle:3 right:1 right:2 right:3
//parallel execution
test("left")&test("middle")&test("right");
//prints: left:1 middle:1 right:1 left:2 middle:2 right:2 left:3 middle:3 right:3
//; vs |
{
{echo("11");echo("12");},
{echo("21");echo("22");},
};
//prints: 11 21 12 22
{
{echo("11")|echo("12");},
{echo("21")|echo("22");},
};
//prints: 11 12 21 22
//& vs ,
function test(name)
{
echo(name + ":1");
echo(name + ":2");
echo(name + ":3");
}|{};
}
test("left") & echo("right");echo ("done");
//prints: left:1 right left:2 left:3 done
test("left"), echo("right");echo ("done");
//prints: left:1 right left:2 done left:3

More examples you can find in the URBI documentation LINK.

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.9.1, 15.05.2017

FLASH Documentation