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 --- firmware/backlight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'firmware/backlight.c') diff --git a/firmware/backlight.c b/firmware/backlight.c index 07cc9532be..66cc6df569 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -130,7 +130,7 @@ static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)]; static const char backlight_thread_name[] = "backlight"; static struct event_queue backlight_queue; #ifdef BACKLIGHT_DRIVER_CLOSE -static struct thread_entry *backlight_thread_p = NULL; +static unsigned int backlight_thread_id = 0; #endif static int backlight_timer SHAREDBSS_ATTR; @@ -744,7 +744,7 @@ void backlight_init(void) * call the appropriate backlight_set_*() functions, only changing light * status if necessary. */ #ifdef BACKLIGHT_DRIVER_CLOSE - backlight_thread_p = + backlight_thread_id = #endif create_thread(backlight_thread, backlight_stack, sizeof(backlight_stack), 0, backlight_thread_name @@ -756,13 +756,13 @@ void backlight_init(void) #ifdef BACKLIGHT_DRIVER_CLOSE void backlight_close(void) { - struct thread_entry *thread = backlight_thread_p; + unsigned int thread = backlight_thread_id; /* Wait for thread to exit */ - if (thread == NULL) + if (thread == 0) return; - backlight_thread_p = NULL; + backlight_thread_id = 0; queue_post(&backlight_queue, BACKLIGHT_QUIT, 0); thread_wait(thread); -- cgit v1.2.3