blob: debdebcc3d17f7906c85be7409153a622423a02b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
igt.os.fork('hello', print).wait();
igt.os.fork([ {delay: 1, msg:'goodbye' }, {delay:0, msg:'world'} ],
function(x) { igt.os.sleep(x.delay); print(x.msg) }).wait();
var job = igt.os.fork('', function(x) { igt.os.exit(1); igt.os.sleep(999); });
print('Exitcode = ' + job.wait());
job = igt.os.fork();
if (job) {
print("Parent shall wait for its child!");
job.wait();
} else {
print("The child wants to play!");
for (var x = 0; x < 10; x++) {
print("Play " + x);
igt.os.sleep(0.1);
}
print("Tired now!");
igt.os.exit(0);
}
print("Only parents allowed after children sleep, exitcode:", job.result);
job = igt.os.fork();
if (job) {
print("No Mr Bond, I expect you to", job.wait());
} else {
badwolf();
}
print("Onwards, all by myself.");
|