kernel/condition_variable: Add a fast-exit from Wait() for negative timeouts.
acquire_sem_etc does something very similar.
This commit is contained in:
@@ -214,6 +214,11 @@ ConditionVariableEntry::Wait(uint32 flags, bigtime_t timeout)
|
|||||||
if (variable == NULL)
|
if (variable == NULL)
|
||||||
return fWaitStatus;
|
return fWaitStatus;
|
||||||
|
|
||||||
|
if ((flags & B_RELATIVE_TIMEOUT) != 0 && timeout <= 0) {
|
||||||
|
_RemoveFromVariable();
|
||||||
|
return B_WOULD_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
InterruptsLocker _;
|
InterruptsLocker _;
|
||||||
SpinLocker schedulerLocker(thread_get_current_thread()->scheduler_lock);
|
SpinLocker schedulerLocker(thread_get_current_thread()->scheduler_lock);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user