Commit 1465bfab authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

pass pc to player_task()

Another global variable cleanup patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 8098d8ff
...@@ -444,7 +444,7 @@ int main(int argc, char *argv[]) ...@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
openVolumeDevice(); openVolumeDevice();
decoderInit(); decoderInit();
playerInit(); playerInit(&getPlayerData()->playerControl);
read_state_file(); read_state_file();
notifyEnter(&main_notify); notifyEnter(&main_notify);
......
...@@ -51,9 +51,9 @@ void player_sleep(PlayerControl *pc) ...@@ -51,9 +51,9 @@ void player_sleep(PlayerControl *pc)
notifyWait(&pc->notify); notifyWait(&pc->notify);
} }
static void * player_task(mpd_unused void *unused) static void * player_task(void *arg)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = arg;
notifyEnter(&pc->notify); notifyEnter(&pc->notify);
...@@ -86,14 +86,14 @@ static void * player_task(mpd_unused void *unused) ...@@ -86,14 +86,14 @@ static void * player_task(mpd_unused void *unused)
return NULL; return NULL;
} }
void playerInit(void) void playerInit(PlayerControl * pc)
{ {
pthread_attr_t attr; pthread_attr_t attr;
pthread_t player_thread; pthread_t player_thread;
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (pthread_create(&player_thread, &attr, player_task, NULL)) if (pthread_create(&player_thread, &attr, player_task, pc))
FATAL("Failed to spawn player task: %s\n", strerror(errno)); FATAL("Failed to spawn player task: %s\n", strerror(errno));
} }
......
...@@ -138,6 +138,6 @@ int getPlayerChannels(void); ...@@ -138,6 +138,6 @@ int getPlayerChannels(void);
Song *playerCurrentDecodeSong(void); Song *playerCurrentDecodeSong(void);
void playerInit(void); void playerInit(PlayerControl * pc);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment