1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Michael Sevakis 2007-11-19 13:26:46 +00:00
parent ed12747da6
commit 4f2473db6c

View file

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