switch_sem_etc() doesn't check the return value of add_timer(), hence we

need to make sure that we never get that far with a negative timeout or
we'll wait forever.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24083 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-02-23 16:01:59 +00:00
parent 098adfe889
commit 20e4f92cf5

View File

@ -864,11 +864,16 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count,
goto err;
}
if (sSems[slot].u.used.count - count < 0 && (flags & B_RELATIVE_TIMEOUT) != 0
&& timeout <= 0) {
// immediate timeout
status = B_WOULD_BLOCK;
goto err;
if (sSems[slot].u.used.count - count < 0) {
if ((flags & B_RELATIVE_TIMEOUT) != 0 && timeout <= 0) {
// immediate timeout
status = B_WOULD_BLOCK;
goto err;
} else if ((flags & B_ABSOLUTE_TIMEOUT) != 0 && timeout < 0) {
// absolute negative timeout
status = B_TIMED_OUT;
goto err;
}
}
if ((sSems[slot].u.used.count -= count) < 0) {