From 8cfbd3604fac14f629244e521ad24ffa9938c790 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 10 Dec 2008 08:57:10 +0000 Subject: 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 --- apps/voice_thread.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apps/voice_thread.c') diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 084c3872c6..86e80cece3 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c @@ -54,7 +54,7 @@ #define VOICE_SAMPLE_DEPTH 16 /* Sample depth in bits */ /* Voice thread variables */ -static struct thread_entry *voice_thread_p = NULL; +static unsigned int voice_thread_id = 0; static long voice_stack[0x7c0/sizeof(long)] IBSS_ATTR_VOICE_STACK; static const char voice_thread_name[] = "voice"; @@ -434,25 +434,25 @@ void voice_thread_init(void) queue_init(&voice_queue, false); mutex_init(&voice_mutex); - voice_thread_p = create_thread(voice_thread, voice_stack, + voice_thread_id = create_thread(voice_thread, voice_stack, sizeof(voice_stack), CREATE_THREAD_FROZEN, voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); queue_enable_queue_send(&voice_queue, &voice_queue_sender_list, - voice_thread_p); + voice_thread_id); } /* voice_thread_init */ /* Unfreeze the voice thread */ void voice_thread_resume(void) { logf("Thawing voice thread"); - thread_thaw(voice_thread_p); + thread_thaw(voice_thread_id); } #ifdef HAVE_PRIORITY_SCHEDULING /* Set the voice thread priority */ void voice_thread_set_priority(int priority) { - thread_set_priority(voice_thread_p, priority); + thread_set_priority(voice_thread_id, priority); } #endif -- cgit v1.2.3