From c33ac538c483b1a41b985cca42cb5d69866547a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 21 Aug 2006 12:02:18 +0000 Subject: [PATCH] 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 --- src/system/kernel/sem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/sem.c b/src/system/kernel/sem.c index 63d4dcdf01..2d42347ffe 100644 --- a/src/system/kernel/sem.c +++ b/src/system/kernel/sem.c @@ -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;