On 30.03.2009, at 17:13, Damien Cassou wrote:
On Mon, Mar 30, 2009 at 5:03 PM, Jordi Delgado jdelgado@lsi.upc.edu wrote:
| s p1 p2 | s := SharedQueue new: 20. p1 := [1 to: 10 do: [:i | s nextPut: i. Processor yield.]] newProcess. p2 := [11 to: 20 do: [:i | s nextPut: i. Processor yield.]] newProcess. p1 priority: Processor activePriority - 1. p2 priority: Processor activePriority - 1. p1 resume. p2 resume. s inspect.
Try to rename your block variables i to i1 and i2. You can also try sending the message #fixTemps to the blocks.
Right. The compiler rewrites the #to:do: loop into a #whileTrue: loop and uses the same method-level temp "i" for both loops. This issue (among others) will be fixed with the "closure compiler".
- Bert -