trouble with the new Mutex

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

trouble with the new Mutex

Chris Muller-4
Hi Eliot, I noticed you revamped Mutex earlier this year, and I'm
having an issue where they're stopped even though there are no other
processes inside the critical block.  Those processes were background
processes that ended up opening a debugger, which was closed.

The Mutex is stuck and I have no internal "semaphore" I can signal
anymore, it appears to be coupled straight to the VM (for better
performance, I assume).

Even when I restart the process in a frame totally above the method
whcih even enters the #critical:, it still halts there.

Reply | Threaded
Open this post in threaded view
|

Re: trouble with the new Mutex

Ben Coman
On Tue, Nov 8, 2016 at 8:31 AM, Chris Muller <[hidden email]> wrote:

> Hi Eliot, I noticed you revamped Mutex earlier this year, and I'm
> having an issue where they're stopped even though there are no other
> processes inside the critical block.  Those processes were background
> processes that ended up opening a debugger, which was closed.
>
> The Mutex is stuck and I have no internal "semaphore" I can signal
> anymore, it appears to be coupled straight to the VM (for better
> performance, I assume).
>
> Even when I restart the process in a frame totally above the method
> whcih even enters the #critical:, it still halts there.
>

What is the value of the 'owner' ivar of the Mutex?
To enter the critical section it needs to be nil.

Otherwise it will a Process you should check its not still in the #critical:
Then send #primitiveExitCriticalSection to the Mutex.
Try this experiement...

Transcript clear; show: Time now; cr.
m := Mutex new.
p1 := [m critical: [Transcript show: 1. p1 suspend]] newProcess priority:41.
p2 := [m critical: [Transcript show: 2]] newProcess priority:41.
p3 := [m critical: [Transcript show: 3]] newProcess priority:41.
p1 resume.
p2 resume.
p3 resume.
"observe only '1' is shown"
m primitiveExitCriticalSection.


It is strange for it to have gotten into that state. '2' and '3' are
always printed by this experiment...

Transcript clear; show: Time now; cr.
m := Mutex new.
p1 := [m critical: [Transcript show: 1. self halt]] newProcess priority:41.
p2 := [m critical: [Transcript show: 2]] newProcess priority:41.
p3 := [m critical: [Transcript show: 3]] newProcess priority:41.
p1 resume.
p2 resume.
p3 resume.

cheers -ben