Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created May 10, 2016 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizmat/60961c6cbcbdf7b9efc5d7d3bd81eec3 to your computer and use it in GitHub Desktop.
Save lizmat/60961c6cbcbdf7b9efc5d7d3bd81eec3 to your computer and use it in GitHub Desktop.
my int $running = 1;
await (^8).map: {
start {
my int $i;
say "starting $*THREAD.id()";
while $running {
++$i;
if rand < 0.0000001 {
say "finished by $*THREAD.id() in $i";
$running = 0;
}
}
say "done $*THREAD.id() after $i";
}
}
sleep 5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment