[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Regarding #1564: srfi-18: (mutex-unlock) Internal
From: |
Jörg F . Wittenberger |
Subject: |
Re: [Chicken-hackers] Regarding #1564: srfi-18: (mutex-unlock) Internal scheduler error |
Date: |
30 Nov 2018 18:20:25 +0100 |
Hello Megane,
On Nov 30 2018, megane wrote:
Hi,
Here's another version that crashes quickly with "very high
probability".
...
24 Error: (mutex-unlock) Internal scheduler error: unknown thread state
25 #<thread: thread1>
26 ready
This bears an uncanny resemblance to scheduler issues I've been fighting a
long ago.
Too long to ago.
--- A fix
Just allow the 'ready state for threads in mutex-unlock!
...
Is this a correct fix?
Too long ago.
But it feels wrong. We'd rather make sure there is no ready thread in the
queue waiting for a mutex in the first place.
Diffing the changes I maintained quite a while back
http://ball.askemos.org/Ad60e3fb123a79b2e5128915116b288f7/chicken-4.9.1-ball.tar.gz
you will find that I added a
##sys#thread-clear-blocking-state!
Towards the end of scheduler.scm and used it for consistency whereever I
ran into not-so-clean unlocks.
Now this is still an invasive change. But looking at the source of
scheduler and srfi-18 in chicken 5 right now, I can't fight the feeling
that it is working around the missing changes at several places.
Best
/Jörg