Fix for issue 6348. Prevent dispatcher deadlock.
This commit is contained in:
parent
9d01a5681e
commit
924817c253
|
@ -51,6 +51,7 @@ void dispatchProcess(uint32_t currentTime)
|
|||
// unlink entry first, so handler can replan self
|
||||
dispatchEntry_t *current = *p;
|
||||
*p = (*p)->next;
|
||||
current->inQue = false;
|
||||
(*current->dispatch)(current);
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +59,17 @@ void dispatchProcess(uint32_t currentTime)
|
|||
void dispatchAdd(dispatchEntry_t *entry, int delayUs)
|
||||
{
|
||||
uint32_t delayedUntil = micros() + delayUs;
|
||||
entry->delayedUntil = delayedUntil;
|
||||
dispatchEntry_t **p = &head;
|
||||
|
||||
if (entry->inQue) {
|
||||
return; // Allready in Queue, abort
|
||||
}
|
||||
|
||||
while (*p && cmp32((*p)->delayedUntil, delayedUntil) < 0)
|
||||
p = &(*p)->next;
|
||||
|
||||
entry->next = *p;
|
||||
entry->delayedUntil = delayedUntil;
|
||||
entry->inQue = true;
|
||||
*p = entry;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct dispatchEntry_s {
|
|||
dispatchFunc *dispatch;
|
||||
uint32_t delayedUntil;
|
||||
struct dispatchEntry_s *next;
|
||||
bool inQue;
|
||||
} dispatchEntry_t;
|
||||
|
||||
bool dispatchIsEnabled(void);
|
||||
|
|
Loading…
Reference in New Issue