diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-12-10 08:57:10 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-12-10 08:57:10 +0000 |
commit | 8cfbd3604fac14f629244e521ad24ffa9938c790 (patch) | |
tree | 16dc096519b8b537bb7d4b73e0c97f5f33ee752b /apps/codecs/spc.c | |
parent | 40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff) | |
download | rockbox-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/spc.c')
-rw-r--r-- | apps/codecs/spc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c index 380cfbdb8b..14d28dfca8 100644 --- a/apps/codecs/spc.c +++ b/apps/codecs/spc.c | |||
@@ -197,7 +197,7 @@ static int spc_emu_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)] | |||
197 | CACHEALIGN_ATTR; | 197 | CACHEALIGN_ATTR; |
198 | 198 | ||
199 | static const unsigned char * const spc_emu_thread_name = "spc emu"; | 199 | static const unsigned char * const spc_emu_thread_name = "spc emu"; |
200 | static struct thread_entry *emu_thread_p; | 200 | static unsigned int emu_thread_id = 0; |
201 | 201 | ||
202 | enum | 202 | enum |
203 | { | 203 | { |
@@ -352,11 +352,11 @@ static void spc_emu_thread(void) | |||
352 | 352 | ||
353 | static bool spc_emu_start(void) | 353 | static bool spc_emu_start(void) |
354 | { | 354 | { |
355 | emu_thread_p = ci->create_thread(spc_emu_thread, spc_emu_thread_stack, | 355 | emu_thread_id = ci->create_thread(spc_emu_thread, spc_emu_thread_stack, |
356 | sizeof(spc_emu_thread_stack), CREATE_THREAD_FROZEN, | 356 | sizeof(spc_emu_thread_stack), CREATE_THREAD_FROZEN, |
357 | spc_emu_thread_name IF_PRIO(, PRIORITY_PLAYBACK), COP); | 357 | spc_emu_thread_name IF_PRIO(, PRIORITY_PLAYBACK), COP); |
358 | 358 | ||
359 | if (emu_thread_p == NULL) | 359 | if (emu_thread_id == 0) |
360 | return false; | 360 | return false; |
361 | 361 | ||
362 | /* Initialize audio queue as full to prevent emu thread from trying to run the | 362 | /* Initialize audio queue as full to prevent emu thread from trying to run the |
@@ -368,7 +368,7 @@ static bool spc_emu_start(void) | |||
368 | sample_queue.tail = 2; | 368 | sample_queue.tail = 2; |
369 | 369 | ||
370 | /* Start it running */ | 370 | /* Start it running */ |
371 | ci->thread_thaw(emu_thread_p); | 371 | ci->thread_thaw(emu_thread_id); |
372 | return true; | 372 | return true; |
373 | } | 373 | } |
374 | 374 | ||
@@ -382,10 +382,10 @@ static inline int load_spc_buffer(uint8_t *buf, size_t size) | |||
382 | 382 | ||
383 | static inline void spc_emu_quit(void) | 383 | static inline void spc_emu_quit(void) |
384 | { | 384 | { |
385 | if (emu_thread_p != NULL) { | 385 | if (emu_thread_id != 0) { |
386 | emu_thread_send_msg(SPC_EMU_QUIT, 0); | 386 | emu_thread_send_msg(SPC_EMU_QUIT, 0); |
387 | /* Wait for emu thread to be killed */ | 387 | /* Wait for emu thread to be killed */ |
388 | ci->thread_wait(emu_thread_p); | 388 | ci->thread_wait(emu_thread_id); |
389 | invalidate_icache(); | 389 | invalidate_icache(); |
390 | } | 390 | } |
391 | } | 391 | } |