diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-11-19 13:26:46 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-11-19 13:26:46 +0000 |
commit | 4f2473db6cecbb80323c5eee576b2e8e0901274f (patch) | |
tree | ffbc7a60c5a471cfdfe24e3fb8a5cf9c09598a9b /apps | |
parent | ed12747da653a082d0d7cc6b2c47d06d902a11ad (diff) |
Do the wait for the audio thread init in such a way to avoid an unlikely but possible roundabout deadlock. Not pretty but will suffice for the moment.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15686 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playback.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/playback.c b/apps/playback.c index 20f8d4fdf7..e2ef2602cf 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -174,6 +174,7 @@ enum { #endif bool audio_is_initialized = false; +static bool audio_thread_ready NOCACHEBSS_ATTR = false; /* Variables are commented with the threads that use them: * * A=audio, C=codec, V=voice. A suffix of - indicates that * @@ -2393,6 +2394,8 @@ static void audio_thread(void) pcm_postinit(); + audio_thread_ready = true; + while (1) { queue_wait_w_tmo(&audio_queue, &ev, HZ/2); @@ -2625,10 +2628,13 @@ void audio_init(void) } /* audio_init */ -/* Wait until audio thread can respond to messages - this implies - * it has finished initialization */ void audio_wait_for_init(void) { - LOGFQUEUE("audio >| Q_NULL"); - queue_send(&audio_queue, Q_NULL, 0); + /* audio thread will only set this once after it finished the final + * audio hardware init so this little construct is safe - even + * cross-core. */ + while (!audio_thread_ready) + { + sleep(0); + } } |