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
This commit is contained in:
Max Kellermann 2008-04-12 04:19:38 +00:00 committed by Eric Wong
parent 8098d8ff8e
commit 1465bfab82
3 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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)
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));
} }

View File

@ -138,6 +138,6 @@ int getPlayerChannels(void);
Song *playerCurrentDecodeSong(void); Song *playerCurrentDecodeSong(void);
void playerInit(void); void playerInit(PlayerControl * pc);
#endif #endif