summaryrefslogtreecommitdiff
path: root/apps/codecs/mpa.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-10 08:57:10 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-10 08:57:10 +0000
commit8cfbd3604fac14f629244e521ad24ffa9938c790 (patch)
tree16dc096519b8b537bb7d4b73e0c97f5f33ee752b /apps/codecs/mpa.c
parent40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff)
downloadrockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.gz
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.zip
Use cookies for thread identification instead of pointers directly which gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mpa.c')
-rw-r--r--apps/codecs/mpa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 7732622383..37a1afadfa 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -200,7 +200,7 @@ static void set_elapsed(struct mp3entry* id3)
200static int mad_synth_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)/2] IBSS_ATTR; 200static int mad_synth_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)/2] IBSS_ATTR;
201 201
202static const unsigned char * const mad_synth_thread_name = "mp3dec"; 202static const unsigned char * const mad_synth_thread_name = "mp3dec";
203static struct thread_entry *mad_synth_thread_p; 203static unsigned int mad_synth_thread_id = 0;
204 204
205 205
206static void mad_synth_thread(void) 206static void mad_synth_thread(void)
@@ -249,14 +249,14 @@ static bool mad_synth_thread_create(void)
249 ci->semaphore_init(&synth_done_sem, 1, 0); 249 ci->semaphore_init(&synth_done_sem, 1, 0);
250 ci->semaphore_init(&synth_pending_sem, 1, 0); 250 ci->semaphore_init(&synth_pending_sem, 1, 0);
251 251
252 mad_synth_thread_p = ci->create_thread(mad_synth_thread, 252 mad_synth_thread_id = ci->create_thread(mad_synth_thread,
253 mad_synth_thread_stack, 253 mad_synth_thread_stack,
254 sizeof(mad_synth_thread_stack), 0, 254 sizeof(mad_synth_thread_stack), 0,
255 mad_synth_thread_name 255 mad_synth_thread_name
256 IF_PRIO(, PRIORITY_PLAYBACK) 256 IF_PRIO(, PRIORITY_PLAYBACK)
257 IF_COP(, COP)); 257 IF_COP(, COP));
258 258
259 if (mad_synth_thread_p == NULL) 259 if (mad_synth_thread_id == 0)
260 return false; 260 return false;
261 261
262 return true; 262 return true;
@@ -267,7 +267,7 @@ static void mad_synth_thread_quit(void)
267 /*mop up COP thread*/ 267 /*mop up COP thread*/
268 die=1; 268 die=1;
269 ci->semaphore_release(&synth_pending_sem); 269 ci->semaphore_release(&synth_pending_sem);
270 ci->thread_wait(mad_synth_thread_p); 270 ci->thread_wait(mad_synth_thread_id);
271 invalidate_icache(); 271 invalidate_icache();
272} 272}
273#else 273#else