cannot step Through critical blocks

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

cannot step Through critical blocks

Chris Muller-4
Debugging "Through" is really really awesome, except when it causes
your image to lock.

At first I thought it was because I had some DNU ahppening when I
pressed Through, like on the send to #critical:, here:

   |mutex| mutex := Mutex new.
   mutex critical: [ [Object new] do: [:err | ] on: Error ]

but then even after correcting it, it happened again:

    |mutex | mutex := Mutex new.
    mutex critical: [ [Object new ] on: Notification do: [ : noti | ] ]

I love Through, but I have no idea how to fix this..

Reply | Threaded
Open this post in threaded view
|

Re: cannot step Through critical blocks

marcel.taeumel
Hi Chris!

It may be that Mutex has no support for re-entrancy. You can use a Semaphore instead:

| accessProtect |
accessProtect := Semaphore forMutualExclusion.
accessProtect critical: [ [Object new ] on: Notification do: [ : noti | ] ].

Then, step-through works.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: cannot step Through critical blocks

Levente Uzonyi
Mutexes are reentrant, while Semaphores are not.
I suspect that primitive 187 doesn't know about effectiveProcess.

Levente

On Thu, 7 Apr 2016, marcel.taeumel wrote:

> Hi Chris!
>
> It may be that Mutex has no support for re-entrancy. You can use a Semaphore
> instead:
>
> | accessProtect |
> accessProtect := Semaphore forMutualExclusion.
> accessProtect critical: [ [Object new ] on: Notification do: [ : noti | ] ].
>
> Then, step-through works.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/cannot-step-Through-critical-blocks-tp4888942p4888976.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>