diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-08-19 03:31:25 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-08-19 03:31:25 -0700 |
commit | 548385ac6cc0bc344762e19117f94258e7ea2251 (patch) | |
tree | dcd2bae159f63d7a234d3ff740402aceea47dfcf /src/outputBuffer.c | |
parent | 3befb84a6a7a95de7e0e94c2f0bd9936ecb60668 (diff) | |
download | mpd-548385ac6cc0bc344762e19117f94258e7ea2251.tar.gz mpd-548385ac6cc0bc344762e19117f94258e7ea2251.tar.xz mpd-548385ac6cc0bc344762e19117f94258e7ea2251.zip |
fix output buffer deadlock when daemonizing
We spawned the output buffer thread before daemonizing in
initPlayerData(), which is ultra bad because daemonizes forks
and threads are not preserved on exit. Since playerData has
been stripped bare by this core-rewrite anyways, move this code
into the outputBuffer_* group and drop playerData.[ch]
completely
I completely forgot to test this :<
Diffstat (limited to '')
-rw-r--r-- | src/outputBuffer.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 26e6077f2..26d31b2cd 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -78,12 +78,6 @@ static struct output_buffer ob; #include "outputBuffer_xfade.h" #include "outputBuffer_accessors.h" -static void ob_free(void) -{ - free(ob.chunks); - ringbuf_free(ob.index); -} - static enum action_status ob_do_stop(void); static void stop_playback(void) { @@ -497,22 +491,7 @@ out: return NULL; } -void ob_init(size_t size) -{ - pthread_attr_t attr; - assert(size > 0 && !ob.index && !ob.chunks); - ob.index = ringbuf_create(size); - ob.chunks = xcalloc(ob.index->size, sizeof(struct ob_chunk)); - ob.preseek_len = xmalloc(ob.index->size * sizeof(ob.chunks[0].len)); - ob.nr_bpp = 1; - ob.state = OB_STATE_STOP; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - if (pthread_create(&ob.thread, &attr, ob_task, NULL)) - FATAL("Failed to spawn player task: %s\n", strerror(errno)); - atexit(ob_free); -} +#include "outputBuffer_config_init.h" void ob_seek_start(void) { |