|
Re: BlockClosure>>fork problem: msg#00094lang.smalltalk.squeak.beginners
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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: BlockClosure>>fork problem, Ron Teitelbaum |
|---|---|
| Next by Date: | Process Scheduling (was Re: BlockClosure>>fork problem), Bert Freudenberg |
| Previous by Thread: | Re: BlockClosure>>fork problem, Bert Freudenberg |
| Next by Thread: | Process Scheduling (was Re: BlockClosure>>fork problem), Bert Freudenberg |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |