From ae1335753adb5bcc49badf98ccbe6ca38152dc2c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 13 Apr 2008 01:15:43 +0000 Subject: 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 --- src/main_notify.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src') 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) -- cgit v1.2.3