aboutsummaryrefslogtreecommitdiffstats
path: root/src/update.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-01 18:22:11 +0100
committerMax Kellermann <max@duempel.org>2009-01-01 18:22:11 +0100
commitb3e2635ac1d6cb46ae5a41e4c9760127453e49db (patch)
treeb3fe2592a7f40eea7c28a2f7a9f6e8b386d61b55 /src/update.c
parent22bb5a5856ff4c195a179610dfb3f09af3183467 (diff)
downloadmpd-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 'src/update.c')
-rw-r--r--src/update.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/update.c b/src/update.c
index 438cd66a8..29d8844b1 100644
--- a/src/update.c
+++ b/src/update.c
@@ -98,7 +98,7 @@ delete_song(struct directory *dir, struct song *del)
cond_enter(&delete_cond);
assert(!delete);
delete = del;
- event_pipe_signal();
+ event_pipe_emit(PIPE_EVENT_DELETE);
do { cond_wait(&delete_cond); } while (delete);
cond_leave(&delete_cond);
@@ -603,7 +603,7 @@ static void * update_task(void *_path)
if (modified)
db_save();
progress = UPDATE_PROGRESS_DONE;
- event_pipe_signal();
+ event_pipe_emit(PIPE_EVENT_UPDATE);
return NULL;
}
@@ -646,7 +646,7 @@ directory_update_init(char *path)
return update_task_id;
}
-void reap_update_task(void)
+static void reap_update_task(void)
{
assert(g_thread_self() == main_task);
@@ -693,6 +693,9 @@ void update_global_init(void)
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS);
cond_init(&delete_cond);
+
+ event_pipe_register(PIPE_EVENT_DELETE, reap_update_task);
+ event_pipe_register(PIPE_EVENT_UPDATE, reap_update_task);
}
void update_global_finish(void)