Acquiring lock, releasing in callback

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Acquiring lock, releasing in callback

senTalker
Hello Dear Pharo users,

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

What do I use in Pharo 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