aboutsummaryrefslogtreecommitdiffstats
path: root/src/main_notify.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* main_notify: define main_task so we can use it for assertionsEric Wong2008-10-061-1/+2
| | | | | It'll be easier to keep track of what code runs in what task/thread this way.
* notify: protect notify->pending with the mutexMax Kellermann2008-09-261-2/+0
| | | | | | | | | | There was a known deadlocking bug in the notify library: when the other thread set notify->pending after the according check in notify_wait(), the latter thread was deadlocked. Resolve this by synchronizing all accesses to notify->pending with the notify object's mutex. Since notify_signal_sync() was never used, we can remove it. As a consequence, we don't need notify_enter() and notify_leave() anymore; eliminate them, too.
* notify: added notify_deinit()Max Kellermann2008-09-241-0/+8
| | | | Destroy the mutex when it is not used anymore.
* main_notify: removed assertion in wakeup_main_task()Max Kellermann2008-09-231-2/+0
| | | | | It is legal to call wakeup_main_task() from within the main thread, e.g. from within a signal handler. Remove the assertion.
* main_notify: use init_async_pipe()Max Kellermann2008-09-231-8/+1
| | | | Remove duplicated code.
* use the notify library in main_notify.cMax Kellermann2008-08-261-10/+7
| | | | Avoid some duplicated code in main_notify.c.
* fix race condition in main_notify.cMax Kellermann2008-04-171-1/+6
| | | | | | | | | | | | The function wait_main_task() is racy: if the function wakeup_via_cond() sees the mutex is locked just before wait_main_task() executes pthread_cond_wait(), the main thread blocks forever. Work around this issue by adding a "pending" flag just like in my notify.c code. A standards-compliant solution should be implemented later. git-svn-id: https://svn.musicpd.org/mpd/trunk@7365 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* main_notify: just use cond_signal to wakeup, no need to trylockEric Wong2008-04-131-11/+1
| | | | | 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
* main_notify: use pthread_cond_signal instead of broadcastEric Wong2008-04-121-1/+1
| | | | | | signal is all we need since we only have one waiter and likely faster git-svn-id: https://svn.musicpd.org/mpd/trunk@7349 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix a deadlock after pause/nextEric Wong2008-04-121-0/+1
| | | | | Oops, forgot to unlock a mutex git-svn-id: https://svn.musicpd.org/mpd/trunk@7348 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix the problem of songs not advancing without client activityEric Wong2008-04-121-0/+130
The select() in the main event loop blocks now (saving us many unnecessary wakeups). This interacted badly with the threads that were trying to wakeup the main task via pthread_cond_signal() since the main task was not blocked on a condition variable, but on select(). So now if we detect a need to wakeup the player, we write to a pipe which select() is watching instead of blindly calling pthread_cond_signal(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f