mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
eventdispatcher, limit event callback count fired in one go
This commit is contained in:
parent
f5b3318726
commit
360e58abde
@ -287,11 +287,16 @@ static void eventTask()
|
||||
EventCallbackInfo evInfo;
|
||||
|
||||
// Wait for queue message
|
||||
int limit = MAX_QUEUE_SIZE;
|
||||
while (xQueueReceive(mQueue, &evInfo, 0) == pdTRUE) {
|
||||
// Invoke callback, if one
|
||||
// Invoke callback, if any
|
||||
if (evInfo.cb != 0) {
|
||||
evInfo.cb(&evInfo.ev); // the function is expected to copy the event information
|
||||
}
|
||||
// limit loop to max queue size to slightly reduce the impact of recursive events
|
||||
if (!--limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Process periodic updates
|
||||
|
Loading…
x
Reference in New Issue
Block a user