George,

You'll find that writing to the Transcript always slows things down. I
assume it's the time for writing to the Transcript that also causes
the second process to start after a different interval each time.
Writing the results into an OrderedCollection will be much faster, and
more predictable:

a := OrderedCollection new.
[10 timesRepeat: [a addLast: '2'. (Delay forMilliseconds: 1) wait]] fork.
[10 timesRepeat: [a addLast: '1'. (Delay forMilliseconds: 1) wait]] fork.
a inspect.

consistently gives 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1.

Without the delay:

a := OrderedCollection new.
[10 timesRepeat: [a addLast: '2']] fork.
[10 timesRepeat: [a addLast: '1']] fork.
a inspect.

consistently gives 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1.

Cheers,
Michael
_______________________________________________
Beginners mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to