diff options
author | Max Kellermann <max@duempel.org> | 2009-01-01 18:22:11 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-01 18:22:11 +0100 |
commit | b3e2635ac1d6cb46ae5a41e4c9760127453e49db (patch) | |
tree | b3fe2592a7f40eea7c28a2f7a9f6e8b386d61b55 /src/event_pipe.h | |
parent | 22bb5a5856ff4c195a179610dfb3f09af3183467 (diff) | |
download | mpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.tar.gz mpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.tar.xz mpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.zip |
event_pipe: added pipe_event enum and callbacks
Make the event_pipe (formerly main_notify) send/receive a set of
events, with a callback for each one.
The default event PIPE_EVENT_SIGNAL does not have a callback. It
is still there for waking up the main thread, when it is waiting for
the player thread.
Diffstat (limited to '')
-rw-r--r-- | src/event_pipe.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/event_pipe.h b/src/event_pipe.h index 5ede0deee..3126df9cd 100644 --- a/src/event_pipe.h +++ b/src/event_pipe.h @@ -23,17 +23,41 @@ #include <glib.h> +enum pipe_event { + /** the default event: the main thread is waiting for somebody, + and this event wakes up the main thread */ + PIPE_EVENT_SIGNAL = 0, + + /** database update was finished */ + PIPE_EVENT_UPDATE, + + /** during database update, a song was deleted */ + PIPE_EVENT_DELETE, + + /** an idle event was emitted */ + PIPE_EVENT_IDLE, + + /** must call syncPlayerAndPlaylist() */ + PIPE_EVENT_PLAYLIST, + + PIPE_EVENT_MAX +}; + +typedef void (*event_pipe_callback_t)(void); + extern GThread *main_task; void event_pipe_init(void); void event_pipe_deinit(void); +void +event_pipe_register(enum pipe_event event, event_pipe_callback_t callback); + +void event_pipe_emit(enum pipe_event event); + void event_pipe_signal(void); void event_pipe_wait(void); -void -main_notify_triggered(void); - #endif /* MAIN_NOTIFY_H */ |