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 /firmware/target/arm | |
parent | 40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff) |
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 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c index c185994bfc..81849d0852 100644 --- a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c @@ -69,7 +69,7 @@ static const unsigned char pmic_ints_regs[2] = #ifdef PMIC_DRIVER_CLOSE static bool pmic_close = false; -static struct thread_entry *mc13783_thread_p = NULL; +static unsigned int mc13783_thread_id = 0; #endif static void mc13783_interrupt_thread(void) @@ -149,7 +149,7 @@ void mc13783_init(void) MC13783_GPIO_ISR = (1ul << MC13783_GPIO_LINE); #ifdef PMIC_DRIVER_CLOSE - mc13783_thread_p = + mc13783_thread_id = #endif create_thread(mc13783_interrupt_thread, mc13783_thread_stack, sizeof(mc13783_thread_stack), 0, @@ -159,16 +159,16 @@ void mc13783_init(void) #ifdef PMIC_DRIVER_CLOSE void mc13783_close(void) { - struct thread_entry *thread = mc13783_thread_p; + unsigned int thread_id = mc13783_thread_p; - if (thread == NULL) + if (thread_id == 0) return; - mc13783_thread_p = NULL; + mc13783_thread_id = 0; pmic_close = true; wakeup_signal(&mc13783_wake); - thread_wait(thread); + thread_wait(thread_id); } #endif /* PMIC_DRIVER_CLOSE */ |