mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
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
This commit is contained in:
parent
40ff47c7ee
commit
8cfbd3604f
32 changed files with 329 additions and 234 deletions
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue