Semaphore could get interrupted by a pending signal, even if that signal was blocked.

This fixes the failure of the fork test 12-1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18546 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-08-21 12:02:18 +00:00
parent 26a9fcd6ab
commit c33ac538c4

View File

@ -563,7 +563,7 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
// do a quick check to see if the thread has any pending signals
// this should catch most of the cases where the thread had a signal
if (((flags & B_CAN_INTERRUPT) && thread->sig_pending)
if (((flags & B_CAN_INTERRUPT) && (thread->sig_pending & ~thread->sig_block_mask) != 0)
|| ((flags & B_KILL_CAN_INTERRUPT)
&& (thread->sig_pending & KILL_SIGNALS))) {
sSems[slot].u.used.count += count;
@ -607,7 +607,8 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
GRAB_THREAD_LOCK();
// check again to see if a signal is pending.
// it may have been delivered while setting up the sem, though it's pretty unlikely
if (((flags & B_CAN_INTERRUPT) && thread->sig_pending)
if (((flags & B_CAN_INTERRUPT)
&& (thread->sig_pending & ~thread->sig_block_mask) != 0)
|| ((flags & B_KILL_CAN_INTERRUPT)
&& (thread->sig_pending & KILL_SIGNALS))) {
struct thread_queue wakeupQueue;