diff options
Diffstat (limited to 'src/thread/thrd_sleep.c')
-rw-r--r-- | src/thread/thrd_sleep.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/thread/thrd_sleep.c b/src/thread/thrd_sleep.c new file mode 100644 index 00000000..e8dfe400 --- /dev/null +++ b/src/thread/thrd_sleep.c @@ -0,0 +1,13 @@ +#include <threads.h> +#include <errno.h> +#include "syscall.h" + +int thrd_sleep(const struct timespec *req, struct timespec *rem) +{ + int ret = __syscall(SYS_nanosleep, req, rem); + switch (ret) { + case 0: return 0; + case -EINTR: return -1; /* value specified by C11 */ + default: return -2; + } +} |