[Newbies] Acquiring lock, releasing in callback

Sebastian Nozzi sebnozzi at gmail.com
Fri Nov 2 17:42:11 UTC 2012


Hello Dear Squeakers,

threads and co. are giving me headaches :-) I wanted to ask for advice...

What do I use in Squeak to prevent more than one thread entering a region, but "releasing" the exclusivity in another block/callback? For example, let's suppose there is an hypothetical class "Lock" that does that.

lock acquire.
longOperation performWhenFinished: [ callback code ... lock release ].
...
rest of the program
...

Is there something like that? Or do I have to simulate it with something else? (Semaphore?)

I am aware or Monitor/Mutex critical:, but I am not sure I can use it in my case.

Thanks in advance,

Sebastian



More information about the Beginners mailing list