diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:15:43 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:15:43 +0000 |
commit | ae1335753adb5bcc49badf98ccbe6ca38152dc2c (patch) | |
tree | 37f3d329e32c39f0a547246e519abda06a1907c3 /src | |
parent | 78370a9759cee1f4ebcf547ba1ae6704e133d9df (diff) | |
download | mpd-ae1335753adb5bcc49badf98ccbe6ca38152dc2c.tar.gz mpd-ae1335753adb5bcc49badf98ccbe6ca38152dc2c.tar.xz mpd-ae1335753adb5bcc49badf98ccbe6ca38152dc2c.zip |
main_notify: just use cond_signal to wakeup, no need to trylock
pthread_cond_signal is a no-op if nothing is waiting on it
git-svn-id: https://svn.musicpd.org/mpd/trunk@7351 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/main_notify.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/main_notify.c b/src/main_notify.c index 1ecc11f3a..1ef514304 100644 --- a/src/main_notify.c +++ b/src/main_notify.c @@ -90,22 +90,12 @@ static int wakeup_via_pipe(void) } } -static void wakeup_via_cond(void) -{ - int ret = pthread_mutex_trylock(&main_wakeup_mutex); - - if (ret == EBUSY) - return; /* nope, no need to wakeup at all */ - pthread_cond_signal(&main_wakeup); - pthread_mutex_unlock(&main_wakeup_mutex); -} - void wakeup_main_task(void) { assert(!pthread_equal(main_task, pthread_self())); if (!wakeup_via_pipe()) - wakeup_via_cond(); + pthread_cond_signal(&main_wakeup); } void main_notify_lock(void) |