blockingqueue.hpp: Fix sem_wait not blocking if task is signaled

sem_wait() can be interrupted if the task receives a signal, however
the blockinglist implementation depends on blocking until the semaphore
can be obtained.
This commit is contained in:
Ville Juven
2023-08-11 07:44:10 +02:00
committed by Beat Küng
parent c0084ab24d
commit 0cae33bf47
+2 -2
View File
@@ -56,7 +56,7 @@ public:
void push(T newItem) void push(T newItem)
{ {
px4_sem_wait(&_sem_head); do {} while (px4_sem_wait(&_sem_head) != 0);
_data[_tail] = newItem; _data[_tail] = newItem;
_tail = (_tail + 1) % N; _tail = (_tail + 1) % N;
@@ -66,7 +66,7 @@ public:
T pop() T pop()
{ {
px4_sem_wait(&_sem_tail); do {} while (px4_sem_wait(&_sem_tail) != 0);
T ret = _data[_head]; T ret = _data[_head];
_head = (_head + 1) % N; _head = (_head + 1) % N;