summaryrefslogtreecommitdiff
path: root/apps/voice_thread.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/voice_thread.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/voice_thread.c')
-rw-r--r--apps/voice_thread.c10
1 files changed, 5 insertions, 5 deletions
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 @@
54#define VOICE_SAMPLE_DEPTH 16 /* Sample depth in bits */ 54#define VOICE_SAMPLE_DEPTH 16 /* Sample depth in bits */
55 55
56/* Voice thread variables */ 56/* Voice thread variables */
57static struct thread_entry *voice_thread_p = NULL; 57static unsigned int voice_thread_id = 0;
58static long voice_stack[0x7c0/sizeof(long)] IBSS_ATTR_VOICE_STACK; 58static long voice_stack[0x7c0/sizeof(long)] IBSS_ATTR_VOICE_STACK;
59static const char voice_thread_name[] = "voice"; 59static const char voice_thread_name[] = "voice";
60 60
@@ -434,25 +434,25 @@ void voice_thread_init(void)
434 queue_init(&voice_queue, false); 434 queue_init(&voice_queue, false);
435 mutex_init(&voice_mutex); 435 mutex_init(&voice_mutex);
436 436
437 voice_thread_p = create_thread(voice_thread, voice_stack, 437 voice_thread_id = create_thread(voice_thread, voice_stack,
438 sizeof(voice_stack), CREATE_THREAD_FROZEN, 438 sizeof(voice_stack), CREATE_THREAD_FROZEN,
439 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); 439 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU));
440 440
441 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list, 441 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
442 voice_thread_p); 442 voice_thread_id);
443} /* voice_thread_init */ 443} /* voice_thread_init */
444 444
445/* Unfreeze the voice thread */ 445/* Unfreeze the voice thread */
446void voice_thread_resume(void) 446void voice_thread_resume(void)
447{ 447{
448 logf("Thawing voice thread"); 448 logf("Thawing voice thread");
449 thread_thaw(voice_thread_p); 449 thread_thaw(voice_thread_id);
450} 450}
451 451
452#ifdef HAVE_PRIORITY_SCHEDULING 452#ifdef HAVE_PRIORITY_SCHEDULING
453/* Set the voice thread priority */ 453/* Set the voice thread priority */
454void voice_thread_set_priority(int priority) 454void voice_thread_set_priority(int priority)
455{ 455{
456 thread_set_priority(voice_thread_p, priority); 456 thread_set_priority(voice_thread_id, priority);
457} 457}
458#endif 458#endif