summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2007-03-09 09:21:11 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2007-03-09 09:21:11 +0000
commit198245a85e965ec537662e1358a66e3a74d5bb11 (patch)
treec823633902ed102747243b288fc27c8569e0a177
parent7e0201558bf15b826d921be440862d79ba09444e (diff)
downloadrockbox-198245a85e965ec537662e1358a66e3a74d5bb11.tar.gz
rockbox-198245a85e965ec537662e1358a66e3a74d5bb11.zip
Temporary fix for a nasty race condition when loading the voice file at boot
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12691 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/talk.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 6629bbb2e5..1854e92cbd 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -27,6 +27,7 @@
#include "file.h"
#include "buffer.h"
#include "system.h"
+#include "kernel.h"
#include "settings.h"
#include "mp3_playback.h"
#include "audio.h"
@@ -79,6 +80,7 @@ const char* const file_thumbnail_ext = ".talk";
#define MAX_THUMBNAIL_BUFSIZE 32768
#endif
+extern bool audio_is_initialized;
/***************** Data types *****************/
@@ -178,6 +180,10 @@ static void load_voicefile(void)
load_size = file_size;
#endif
+ /* Wait until the audio is initialized before continuing */
+ while(!audio_is_initialized)
+ sleep(HZ/100);
+
got_size = read(filehandle, audiobuf, load_size);
if (got_size != load_size /* failure */)
goto load_err;