mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Fix a hole in the scheduler where collisions between waking blocked threads in mutexes with interrupts waking blocked threads in message queues can occur. Queue posts will put the threads on a separate list that is then added to the running list with IRQs disabled on the next task switch or CPU wakeup. Basically no overhead for other operations. Seems a likely cause of my occasional observation of the backlight fade causing playback threads to stop running and a recently reported blocking violation upon USB plugging. Time will tell but banging the backlight on and off frequently hasn't hiccuped again for me on H120.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12915 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5e2984ad80
commit
165f62d0cd
3 changed files with 70 additions and 7 deletions
|
@ -126,7 +126,7 @@ static void queue_release_sender(struct thread_entry **sender,
|
|||
intptr_t retval)
|
||||
{
|
||||
(*sender)->retval = retval;
|
||||
wakeup_thread(sender);
|
||||
wakeup_thread_irq_safe(sender);
|
||||
#if 0
|
||||
/* This should _never_ happen - there must never be multiple
|
||||
threads in this list and it is a corrupt state */
|
||||
|
@ -289,11 +289,14 @@ void queue_post(struct event_queue *q, long id, intptr_t data)
|
|||
}
|
||||
#endif
|
||||
|
||||
wakeup_thread(&q->thread);
|
||||
wakeup_thread_irq_safe(&q->thread);
|
||||
set_irq_level(oldlevel);
|
||||
}
|
||||
|
||||
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
|
||||
/* No wakeup_thread_irq_safe here because IRQ handlers are not allowed
|
||||
use of this function - we only aim to protect the queue integrity by
|
||||
turning them off. */
|
||||
intptr_t queue_send(struct event_queue *q, long id, intptr_t data)
|
||||
{
|
||||
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue