diff options
author | Max Kellermann <max@duempel.org> | 2009-01-02 11:20:41 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-02 11:20:41 +0100 |
commit | 272ee5f7d2be764d5edef2db763f50438689b48c (patch) | |
tree | 871f80692a7f9f1d2f02173fc49d1183819eae55 /src/event_pipe.c | |
parent | daf7c3db5aac09a8376f1c8ed499eb17202f77a9 (diff) | |
download | mpd-272ee5f7d2be764d5edef2db763f50438689b48c.tar.gz mpd-272ee5f7d2be764d5edef2db763f50438689b48c.tar.xz mpd-272ee5f7d2be764d5edef2db763f50438689b48c.zip |
event_pipe: replaced PIPE_EVENT_SIGNAL with main_notify
There is only one location using PIPE_EVENT_SIGNAL: to synchronize
player_command() with player_command_finished(). Use the "notify"
library instead of the event_pipe here.
Diffstat (limited to '')
-rw-r--r-- | src/event_pipe.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/event_pipe.c b/src/event_pipe.c index 318e59df6..8d9a7fed3 100644 --- a/src/event_pipe.c +++ b/src/event_pipe.c @@ -39,13 +39,13 @@ static void event_pipe_invoke(enum pipe_event event) { assert((unsigned)event < PIPE_EVENT_MAX); - assert(event != PIPE_EVENT_SIGNAL); assert(event_pipe_callbacks[event] != NULL); event_pipe_callbacks[event](); } -static bool consume_pipe(void) +static void +consume_pipe(void) { char buffer[256]; ssize_t r = read(event_pipe[0], buffer, sizeof(buffer)); @@ -60,13 +60,9 @@ static bool consume_pipe(void) g_mutex_unlock(event_pipe_mutex); for (unsigned i = 0; i < PIPE_EVENT_MAX; ++i) - if (i != PIPE_EVENT_SIGNAL && events[i]) - /* invoke the event handler; the SIGNAL event - has no handler, because it is handled by - the event_pipe_wait() caller */ + if (events[i]) + /* invoke the event handler */ event_pipe_invoke(i); - - return events[PIPE_EVENT_SIGNAL]; } static gboolean @@ -109,7 +105,6 @@ void event_pipe_deinit(void) void event_pipe_register(enum pipe_event event, event_pipe_callback_t callback) { - assert(event != PIPE_EVENT_SIGNAL); assert((unsigned)event < PIPE_EVENT_MAX); assert(event_pipe_callbacks[event] == NULL); @@ -145,11 +140,6 @@ void event_pipe_emit_fast(enum pipe_event event) write(event_pipe[1], "", 1); } -void event_pipe_signal(void) -{ - event_pipe_emit(PIPE_EVENT_SIGNAL); -} - void event_pipe_wait(void) { consume_pipe(); |