Hi all,

I'm a little confused about processes.

I entered the code
[10 timesRepeat: [Transcript show: '1'. Processor yield]] fork.
[10 timesRepeat: [Transcript show: '2'. Processor yield]] fork
in the file "DummyProcesses.st" and ran with "gst DummyProcesses.st". The result is what I have expected:
12121212121212121212

If I change the code with
[10 timesRepeat: [Transcript show: '1'. (Delay forMilliseconds: 1) wait]] fork. [10 timesRepeat: [Transcript show: '2'. (Delay forMilliseconds: 1) wait]] fork
and run it again I get different results. Like
12
or
121
or
1212
, etc.

If I add
(Delay forMilliseconds: 100) wait
and run it, the two processes finish with different result every time.

Am I doing something wrong or this should be the right behavior?


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to