RosettaCodeData/Task/Fork/Smalltalk/fork.st
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

10 lines
267 B
Smalltalk

'Here I am' displayNl.
|a|
a := [
(Delay forSeconds: 2) wait .
1 to: 100 do: [ :i | i displayNl ]
] fork.
'Child will start after 2 seconds' displayNl.
"wait to avoid terminating first the parent;
a better way should use semaphores"
(Delay forSeconds: 10) wait.