mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-03 05:37:23 +00:00
porting/npl/linux: Handle EINTR from sem_timedwait
It's been observed that `sem_timedwait()` can return `EINTR` even if `sigaction()` specified `SA_RESTART`. Not sure what the deal with that is but handling it is simple enough.
This commit is contained in:
committed by
Szymon Janc
parent
f8d60614b7
commit
42e5a2816d
@@ -71,9 +71,14 @@ ble_npl_sem_pend(struct ble_npl_sem *sem, uint32_t timeout)
|
|||||||
wait.tv_sec += timeout / 1000;
|
wait.tv_sec += timeout / 1000;
|
||||||
wait.tv_nsec += (timeout % 1000) * 1000000;
|
wait.tv_nsec += (timeout % 1000) * 1000000;
|
||||||
|
|
||||||
err = sem_timedwait(&sem->lock, &wait);
|
while ((err = sem_timedwait(&sem->lock, &wait)) != 0) {
|
||||||
if (err && errno == ETIMEDOUT) {
|
switch (errno) {
|
||||||
return BLE_NPL_TIMEOUT;
|
case EINTR:
|
||||||
|
continue;
|
||||||
|
case ETIMEDOUT:
|
||||||
|
return BLE_NPL_TIMEOUT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user