From b42974eee12414e28157f53b0d7095515b788785 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 06:55:08 +0200 Subject: 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. --- src/notify.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/notify.c b/src/notify.c index 5aaecd0ad..e6bb98bba 100644 --- a/src/notify.c +++ b/src/notify.c @@ -43,9 +43,8 @@ void notify_deinit(struct notify *notify) void notify_wait(struct notify *notify) { pthread_mutex_lock(¬ify->mutex); - if (!notify->pending) + while (!notify->pending) pthread_cond_wait(¬ify->cond, ¬ify->mutex); - assert(notify->pending); notify->pending = 0; pthread_mutex_unlock(¬ify->mutex); } -- cgit v1.2.3