Mutex error?

David Shaffer cdshaffer at acm.org
Sun Feb 18 19:43:04 UTC 2007


I think the current Squeak compiler allocates block arguments and temps 
in the same context as the block is created in.  Try naming the two 
block arguments differently:

semaphore := Mutex new.
[1 to: 100 do: [:i | semaphore critical:[ Transcript cr; show: i]]] fork.
[101 to: 200 do: [:j | semaphore critical:[ Transcript cr; show: j]]] fork.

Other options include sending fixTemps to the blocks to ensure that their temporary variables are actually different.

David






More information about the Squeak-dev mailing list