summaryrefslogtreecommitdiff
path: root/apps/codecs
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
parent40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff)
downloadrockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.zip
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.gz
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.bz2
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.xz
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')
-rw-r--r--apps/codecs/mpa.c8
-rw-r--r--apps/codecs/spc.c12
2 files changed, 10 insertions, 10 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 7732622..37a1afa 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -200,7 +200,7 @@ static void set_elapsed(struct mp3entry* id3)
static int mad_synth_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)/2] IBSS_ATTR;
static const unsigned char * const mad_synth_thread_name = "mp3dec";
-static struct thread_entry *mad_synth_thread_p;
+static unsigned int mad_synth_thread_id = 0;
static void mad_synth_thread(void)
@@ -249,14 +249,14 @@ static bool mad_synth_thread_create(void)
ci->semaphore_init(&synth_done_sem, 1, 0);
ci->semaphore_init(&synth_pending_sem, 1, 0);
- mad_synth_thread_p = ci->create_thread(mad_synth_thread,
+ mad_synth_thread_id = ci->create_thread(mad_synth_thread,
mad_synth_thread_stack,
sizeof(mad_synth_thread_stack), 0,
mad_synth_thread_name
IF_PRIO(, PRIORITY_PLAYBACK)
IF_COP(, COP));
- if (mad_synth_thread_p == NULL)
+ if (mad_synth_thread_id == 0)
return false;
return true;
@@ -267,7 +267,7 @@ static void mad_synth_thread_quit(void)
/*mop up COP thread*/
die=1;
ci->semaphore_release(&synth_pending_sem);
- ci->thread_wait(mad_synth_thread_p);
+ ci->thread_wait(mad_synth_thread_id);
invalidate_icache();
}
#else
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 380cfbd..14d28df 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)]
CACHEALIGN_ATTR;
static const unsigned char * const spc_emu_thread_name = "spc emu";
-static struct thread_entry *emu_thread_p;
+static unsigned int emu_thread_id = 0;
enum
{
@@ -352,11 +352,11 @@ static void spc_emu_thread(void)
static bool spc_emu_start(void)
{
- emu_thread_p = ci->create_thread(spc_emu_thread, spc_emu_thread_stack,
+ emu_thread_id = ci->create_thread(spc_emu_thread, spc_emu_thread_stack,
sizeof(spc_emu_thread_stack), CREATE_THREAD_FROZEN,
spc_emu_thread_name IF_PRIO(, PRIORITY_PLAYBACK), COP);
- if (emu_thread_p == NULL)
+ if (emu_thread_id == 0)
return false;
/* Initialize audio queue as full to prevent emu thread from trying to run the
@@ -368,7 +368,7 @@ static bool spc_emu_start(void)
sample_queue.tail = 2;
/* Start it running */
- ci->thread_thaw(emu_thread_p);
+ ci->thread_thaw(emu_thread_id);
return true;
}
@@ -382,10 +382,10 @@ static inline int load_spc_buffer(uint8_t *buf, size_t size)
static inline void spc_emu_quit(void)
{
- if (emu_thread_p != NULL) {
+ if (emu_thread_id != 0) {
emu_thread_send_msg(SPC_EMU_QUIT, 0);
/* Wait for emu thread to be killed */
- ci->thread_wait(emu_thread_p);
+ ci->thread_wait(emu_thread_id);
invalidate_icache();
}
}