aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 06:55:08 +0200
committerMax Kellermann <max@duempel.org>2008-10-08 06:55:08 +0200
commitb42974eee12414e28157f53b0d7095515b788785 (patch)
treeefb8d5ec6ac109744a4f775c45fe732b139367ce
parent46eda29d1cd5948ca1342dd4c45d3e8c4d51e205 (diff)
downloadmpd-b42974eee12414e28157f53b0d7095515b788785.tar.gz
mpd-b42974eee12414e28157f53b0d7095515b788785.tar.xz
mpd-b42974eee12414e28157f53b0d7095515b788785.zip
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.
-rw-r--r--src/notify.c3
1 files changed, 1 insertions, 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(&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);
}