David Xu 94f0972bec Fix a long standing race between sleep queue and thread
suspension code. When a thread A is going to sleep, it calls
sleepq_catch_signals() to detect any pending signals or thread
suspension request, if nothing happens, it returns without
holding process lock or scheduler lock, this opens a race
window which allows thread B to come in and do process
suspension work, however since A is still at running state,
thread B can do nothing to A, thread A continues, and puts
itself into actually sleeping state, but B has never seen it,
and it sits there forever until B is woken up by other threads
sometimes later(this can be very long delay or never
happen). Fix this bug by forcing sleepq_catch_signals to
return with scheduler lock held.
Fix sleepq_abort() by passing it an interrupted code, previously,
it worked as wakeup_one(), and the interruption can not be
identified correctly by sleep queue code when the sleeping
thread is resumed.
Let thread_suspend_check() returns EINTR or ERESTART, so sleep
queue no longer has to use SIGSTOP as a hack to build a return
value.

Reviewed by:	jhb
MFC after:	1 week
2006-02-15 23:52:01 +00:00
..
2006-02-10 19:01:02 +00:00
2005-12-04 02:12:43 +00:00
2006-02-15 18:36:52 +00:00
2006-02-14 12:55:07 +00:00
2006-02-15 08:25:40 +00:00
2006-02-14 15:22:24 +00:00
2006-01-21 10:44:34 +00:00
2006-01-21 10:44:34 +00:00
2006-02-09 11:50:22 +00:00
2006-02-11 23:55:08 +00:00
2006-01-30 16:32:08 +00:00