File: partakefirst1.g

package info (click to toggle)
gap-io 4.7.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 772 kB
  • sloc: xml: 2,871; ansic: 2,685; makefile: 36; sh: 6
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");