[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Processes
From: |
Stefan Izota |
Subject: |
[Help-smalltalk] Processes |
Date: |
Mon, 16 Nov 2009 10:55:43 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
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] Processes,
Stefan Izota <=