File: partakefirst1.g

package info (click to toggle)
gap-io 4.4.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 740 kB
  • ctags: 106
  • sloc: xml: 2,857; ansic: 2,823; sh: 38; makefile: 35
file content (12 lines) | stat: -rw-r--r-- 509 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
LoadPackage("io");
f := function(delay,x)
  Sleep(delay);
  return x^10;
end;
Print(ParTakeFirstResultByFork([f,f,f],[[2,17],[3,18],[4,19]]),"\n");
Print(ParTakeFirstResultByFork([f,f,f],[[4,17],[3,18],[4,19]]),"\n");
Print(ParTakeFirstResultByFork([f,f,f],[[4,17],[3,18],[2,19]]),"\n");
# A race condition:
Print(ParTakeFirstResultByFork([f,f,f],[[1,1],[1,2],[1,3]]),"\n");
Print(ParTakeFirstResultByFork([f,f,f],[[1,1],[1,2],[1,3]]),"\n");
Print(ParTakeFirstResultByFork([f,f,f],[[1,1],[1,2],[1,3]]),"\n");