diff options
author | Max Kellermann <max@duempel.org> | 2009-01-01 18:12:14 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-01 18:12:14 +0100 |
commit | 22bb5a5856ff4c195a179610dfb3f09af3183467 (patch) | |
tree | ffc7fede9d6208559217a82b7283725bfd114d31 /src | |
parent | 9f5934d95bac6436ccc9a6dadc57e1e062505a79 (diff) | |
download | mpd-22bb5a5856ff4c195a179610dfb3f09af3183467.tar.gz mpd-22bb5a5856ff4c195a179610dfb3f09af3183467.tar.xz mpd-22bb5a5856ff4c195a179610dfb3f09af3183467.zip |
event_pipe: renamed functions from main_notify_* to event_pipe_*
Continuing the previous patch.
Diffstat (limited to '')
-rw-r--r-- | src/database.c | 2 | ||||
-rw-r--r-- | src/event_pipe.c | 24 | ||||
-rw-r--r-- | src/event_pipe.h | 8 | ||||
-rw-r--r-- | src/idle.c | 2 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/player_control.c | 2 | ||||
-rw-r--r-- | src/player_thread.c | 8 | ||||
-rw-r--r-- | src/update.c | 4 |
8 files changed, 27 insertions, 27 deletions
diff --git a/src/database.c b/src/database.c index 8b66bc070..c7acd8534 100644 --- a/src/database.c +++ b/src/database.c @@ -58,7 +58,7 @@ db_init(void) g_error("directory update failed"); do { - wait_main_task(); + event_pipe_wait(); reap_update_task(); } while (isUpdatingDB()); diff --git a/src/event_pipe.c b/src/event_pipe.c index ac76209da..6ae70565e 100644 --- a/src/event_pipe.c +++ b/src/event_pipe.c @@ -26,13 +26,13 @@ #include <glib.h> #include <string.h> -static int main_pipe[2]; GThread *main_task; +static int event_pipe[2]; static void consume_pipe(void) { char buffer[256]; - ssize_t r = read(main_pipe[0], buffer, sizeof(buffer)); + ssize_t r = read(event_pipe[0], buffer, sizeof(buffer)); if (r < 0 && errno != EAGAIN && errno != EINTR) FATAL("error reading from pipe: %s\n", strerror(errno)); @@ -48,38 +48,38 @@ main_notify_event(G_GNUC_UNUSED GIOChannel *source, return true; } -void init_main_notify(void) +void event_pipe_init(void) { GIOChannel *channel; main_task = g_thread_self(); - if (pipe(main_pipe) < 0) + if (pipe(event_pipe) < 0) g_error("Couldn't open pipe: %s", strerror(errno)); - if (set_nonblocking(main_pipe[1]) < 0) + if (set_nonblocking(event_pipe[1]) < 0) g_error("Couldn't set non-blocking I/O: %s", strerror(errno)); - channel = g_io_channel_unix_new(main_pipe[0]); + channel = g_io_channel_unix_new(event_pipe[0]); g_io_add_watch(channel, G_IO_IN, main_notify_event, NULL); g_io_channel_unref(channel); main_task = g_thread_self(); } -void deinit_main_notify(void) +void event_pipe_deinit(void) { - xclose(main_pipe[0]); - xclose(main_pipe[1]); + xclose(event_pipe[0]); + xclose(event_pipe[1]); } -void wakeup_main_task(void) +void event_pipe_signal(void) { - ssize_t w = write(main_pipe[1], "", 1); + ssize_t w = write(event_pipe[1], "", 1); if (w < 0 && errno != EAGAIN && errno != EINTR) g_error("error writing to pipe: %s", strerror(errno)); } -void wait_main_task(void) +void event_pipe_wait(void) { consume_pipe(); } diff --git a/src/event_pipe.h b/src/event_pipe.h index ddcc420b7..5ede0deee 100644 --- a/src/event_pipe.h +++ b/src/event_pipe.h @@ -25,13 +25,13 @@ extern GThread *main_task; -void init_main_notify(void); +void event_pipe_init(void); -void deinit_main_notify(void); +void event_pipe_deinit(void); -void wakeup_main_task(void); +void event_pipe_signal(void); -void wait_main_task(void); +void event_pipe_wait(void); void main_notify_triggered(void); diff --git a/src/idle.c b/src/idle.c index f7c3aadd3..bc857723f 100644 --- a/src/idle.c +++ b/src/idle.c @@ -66,7 +66,7 @@ idle_add(unsigned flags) idle_flags |= flags; g_mutex_unlock(idle_mutex); - wakeup_main_task(); + event_pipe_signal(); } unsigned diff --git a/src/main.c b/src/main.c index 98aeb7890..f7ab7f1ee 100644 --- a/src/main.c +++ b/src/main.c @@ -253,7 +253,7 @@ int main(int argc, char *argv[]) decoder_plugin_init_all(); update_global_init(); - init_main_notify(); + event_pipe_init(); openDB(&options, argv[0]); @@ -308,7 +308,7 @@ int main(int argc, char *argv[]) g_debug("db_finish took %f seconds", ((float)(clock()-start))/CLOCKS_PER_SEC); - deinit_main_notify(); + event_pipe_deinit(); input_stream_global_finish(); finishNormalization(); diff --git a/src/player_control.c b/src/player_control.c index 4560dec81..63ed75f7b 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -58,7 +58,7 @@ static void player_command(enum player_command cmd) pc.command = cmd; while (pc.command != PLAYER_COMMAND_NONE) { notify_signal(&pc.notify); - wait_main_task(); + event_pipe_wait(); } } diff --git a/src/player_thread.c b/src/player_thread.c index c8352555b..75419c9b9 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -83,14 +83,14 @@ static void player_command_finished(void) assert(pc.command != PLAYER_COMMAND_NONE); pc.command = PLAYER_COMMAND_NONE; - wakeup_main_task(); + event_pipe_signal(); } static void player_stop_decoder(void) { dc_stop(&pc.notify); pc.state = PLAYER_STATE_STOP; - wakeup_main_task(); + event_pipe_signal(); } static int player_wait_for_decoder(struct player *player) @@ -369,7 +369,7 @@ static void do_play(void) request the next song from the playlist */ pc.next_song = NULL; - wakeup_main_task(); + event_pipe_signal(); } if (decoder_is_idle() && player.queued) { @@ -476,7 +476,7 @@ static void do_play(void) if (player_wait_for_decoder(&player) < 0) return; - wakeup_main_task(); + event_pipe_signal(); } else if (decoder_is_idle()) { break; } else { diff --git a/src/update.c b/src/update.c index 4d0ed5118..438cd66a8 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; - wakeup_main_task(); + event_pipe_signal(); 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; - wakeup_main_task(); + event_pipe_signal(); return NULL; } |