mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-07 03:40:15 +00:00
libc: return on nanosleep with zero timeout
In case the calculated timeout value is zero return directly and do not call Libc::suspend as it will suspend us indefinitely. Fixes #2636.
This commit is contained in:
parent
2b711f59ed
commit
a867c29633
@ -21,6 +21,8 @@ int _nanosleep(const struct timespec *req, struct timespec *rem)
|
|||||||
{
|
{
|
||||||
unsigned long sleep_ms = req->tv_sec*1000 + req->tv_nsec/1000000;
|
unsigned long sleep_ms = req->tv_sec*1000 + req->tv_nsec/1000000;
|
||||||
|
|
||||||
|
if (!sleep_ms) return 0;
|
||||||
|
|
||||||
struct Check : Libc::Suspend_functor { bool suspend() override { return true; } } check;
|
struct Check : Libc::Suspend_functor { bool suspend() override { return true; } } check;
|
||||||
do { sleep_ms = Libc::suspend(check, sleep_ms); } while (sleep_ms);
|
do { sleep_ms = Libc::suspend(check, sleep_ms); } while (sleep_ms);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user