WorkQueue: avoid potential semaphore counter overflow

This could happen in the following cases:
- IRQ/publisher rate is faster than the processing rate, and therefore
  WorkQueue::Add is called at a higher rate
- a long-running or stuck task that blocks the work queue a long time

Both cases are not expected to happen under 'normal' circumstances (if the
system runs as expected).
This commit is contained in:
Beat Küng
2019-10-16 18:29:26 +02:00
committed by Julian Oes
parent 2296c9acfa
commit 25aded36ec
2 changed files with 14 additions and 5 deletions
@@ -76,6 +76,8 @@ private:
bool should_exit() const { return _should_exit.load(); }
inline void signal_worker_thread();
#ifdef __PX4_NUTTX
// In NuttX work can be enqueued from an ISR
void work_lock() { _flags = enter_critical_section(); }