Commit b42974ee authored by Max Kellermann's avatar Max Kellermann

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.
parent 46eda29d
......@@ -43,9 +43,8 @@ void notify_deinit(struct notify *notify)
void notify_wait(struct notify *notify)
{
pthread_mutex_lock(&notify->mutex);
if (!notify->pending)
while (!notify->pending)
pthread_cond_wait(&notify->cond, &notify->mutex);
assert(notify->pending);
notify->pending = 0;
pthread_mutex_unlock(&notify->mutex);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment