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/recorder/pcm_record.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/recorder/pcm_record.c')
-rw-r--r-- | apps/recorder/pcm_record.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c index dbbc6901ec..9ceb68c796 100644 --- a/apps/recorder/pcm_record.c +++ b/apps/recorder/pcm_record.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | /***************************************************************************/ | 38 | /***************************************************************************/ |
39 | 39 | ||
40 | extern struct thread_entry *codec_thread_p; | 40 | extern uintptr_t codec_thread_id; |
41 | 41 | ||
42 | /** General recording state **/ | 42 | /** General recording state **/ |
43 | static bool is_recording; /* We are recording */ | 43 | static bool is_recording; /* We are recording */ |
@@ -220,7 +220,7 @@ static struct event_queue pcmrec_queue SHAREDBSS_ATTR; | |||
220 | static struct queue_sender_list pcmrec_queue_send SHAREDBSS_ATTR; | 220 | static struct queue_sender_list pcmrec_queue_send SHAREDBSS_ATTR; |
221 | static long pcmrec_stack[3*DEFAULT_STACK_SIZE/sizeof(long)]; | 221 | static long pcmrec_stack[3*DEFAULT_STACK_SIZE/sizeof(long)]; |
222 | static const char pcmrec_thread_name[] = "pcmrec"; | 222 | static const char pcmrec_thread_name[] = "pcmrec"; |
223 | static struct thread_entry *pcmrec_thread_p; | 223 | static unsigned int pcmrec_thread_id = 0; |
224 | 224 | ||
225 | static void pcmrec_thread(void); | 225 | static void pcmrec_thread(void); |
226 | 226 | ||
@@ -365,12 +365,12 @@ unsigned long pcm_rec_sample_rate(void) | |||
365 | void pcm_rec_init(void) | 365 | void pcm_rec_init(void) |
366 | { | 366 | { |
367 | queue_init(&pcmrec_queue, true); | 367 | queue_init(&pcmrec_queue, true); |
368 | pcmrec_thread_p = | 368 | pcmrec_thread_id = |
369 | create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack), | 369 | create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack), |
370 | 0, pcmrec_thread_name IF_PRIO(, PRIORITY_RECORDING) | 370 | 0, pcmrec_thread_name IF_PRIO(, PRIORITY_RECORDING) |
371 | IF_COP(, CPU)); | 371 | IF_COP(, CPU)); |
372 | queue_enable_queue_send(&pcmrec_queue, &pcmrec_queue_send, | 372 | queue_enable_queue_send(&pcmrec_queue, &pcmrec_queue_send, |
373 | pcmrec_thread_p); | 373 | pcmrec_thread_id); |
374 | } /* pcm_rec_init */ | 374 | } /* pcm_rec_init */ |
375 | 375 | ||
376 | /** audio_* group **/ | 376 | /** audio_* group **/ |
@@ -878,10 +878,10 @@ static void pcmrec_flush(unsigned flush_num) | |||
878 | priority until finished */ | 878 | priority until finished */ |
879 | logf("pcmrec: boost (%s)", | 879 | logf("pcmrec: boost (%s)", |
880 | num >= flood_watermark ? "num" : "time"); | 880 | num >= flood_watermark ? "num" : "time"); |
881 | prio_pcmrec = thread_set_priority(NULL, | 881 | prio_pcmrec = thread_set_priority(THREAD_ID_CURRENT, |
882 | thread_get_priority(NULL) - 4); | 882 | thread_get_priority(THREAD_ID_CURRENT) - 4); |
883 | prio_codec = thread_set_priority(codec_thread_p, | 883 | prio_codec = thread_set_priority(codec_thread_id, |
884 | thread_get_priority(codec_thread_p) - 4); | 884 | thread_get_priority(codec_thread_id) - 4); |
885 | } | 885 | } |
886 | #endif | 886 | #endif |
887 | 887 | ||
@@ -931,8 +931,8 @@ static void pcmrec_flush(unsigned flush_num) | |||
931 | { | 931 | { |
932 | /* return to original priorities */ | 932 | /* return to original priorities */ |
933 | logf("pcmrec: unboost priority"); | 933 | logf("pcmrec: unboost priority"); |
934 | thread_set_priority(NULL, prio_pcmrec); | 934 | thread_set_priority(THREAD_ID_CURRENT, prio_pcmrec); |
935 | thread_set_priority(codec_thread_p, prio_codec); | 935 | thread_set_priority(codec_thread_id, prio_codec); |
936 | } | 936 | } |
937 | 937 | ||
938 | last_flush_tick = current_tick; /* save tick when we left */ | 938 | last_flush_tick = current_tick; /* save tick when we left */ |