Subject: Re: pthread_{suspend,resume}_np
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 08/11/2003 16:19:55
In article <200308110220.WAA12587@stups.com>,
Stephan Uphoff <ups@stups.com> wrote:
>
>Christos Zoulas wrote:
>> I need pthread_{suspend,resume}_np for java. I took a stab at their
>> implementation, but I am missing something because sometimes I get
>> an assertion failure in pthread__sched_bulk() where qhead == head of
>> runq. Any ideas?
>
>The transitions of a thread state from PT_STATE_BLOCKED_QUEUE to
>state PT_STATE_RUNNABLE looks a little bit rocky.
>(An example would be pthread_cond_signal())
>
>   It does not involve a pt_statelock
>	
>   There is a time-window where no locks are held and
>	- the thread is still in state PT_STATE_BLOCKED_QUEUE
>	- the thread is already removed from the sleep queue
>	- the thread is on the way to the run queue
>
>If pthread_suspend_np is called during this time window it could screw
>up the sleep,run and suspend queue.
>

but these are generic bugs, they are not in the code I added :-) Seriously
unless someone steps up and describes what locks need to be held for what
queue/variable changes, the code will never work.

christos