notify: loop while no signal is pending
pthread_cond_wait() may wake up spuriously. To prevent superfluous state checks, loop until the "pending" flag becomes true. Removed the dangerous assertion.
This commit is contained in:
parent
46eda29d1c
commit
b42974eee1
@ -43,9 +43,8 @@ void notify_deinit(struct notify *notify)
|
|||||||
void notify_wait(struct notify *notify)
|
void notify_wait(struct notify *notify)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(¬ify->mutex);
|
pthread_mutex_lock(¬ify->mutex);
|
||||||
if (!notify->pending)
|
while (!notify->pending)
|
||||||
pthread_cond_wait(¬ify->cond, ¬ify->mutex);
|
pthread_cond_wait(¬ify->cond, ¬ify->mutex);
|
||||||
assert(notify->pending);
|
|
||||||
notify->pending = 0;
|
notify->pending = 0;
|
||||||
pthread_mutex_unlock(¬ify->mutex);
|
pthread_mutex_unlock(¬ify->mutex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user