mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 18:06:39 +08:00
px4_work_queue: sem_wait add loop as the wait may be interrupted by a signal
This commit is contained in:
@@ -84,7 +84,8 @@ private:
|
||||
void work_unlock() { leave_critical_section(_flags); }
|
||||
irqstate_t _flags;
|
||||
#else
|
||||
void work_lock() { px4_sem_wait(&_qlock); }
|
||||
// loop as the wait may be interrupted by a signal
|
||||
void work_lock() { do {} while (px4_sem_wait(&_qlock) != 0); }
|
||||
void work_unlock() { px4_sem_post(&_qlock); }
|
||||
px4_sem_t _qlock;
|
||||
#endif
|
||||
|
||||
@@ -149,7 +149,8 @@ void
|
||||
WorkQueue::Run()
|
||||
{
|
||||
while (!should_exit()) {
|
||||
px4_sem_wait(&_process_lock);
|
||||
// loop as the wait may be interrupted by a signal
|
||||
do {} while (px4_sem_wait(&_process_lock) != 0);
|
||||
|
||||
work_lock();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user