]> git.proxmox.com Git - wasi-libc.git/blame - libc-top-half/musl/src/thread/thrd_sleep.c
threads: implement support for pthread mutexes (#315)
[wasi-libc.git] / libc-top-half / musl / src / thread / thrd_sleep.c
CommitLineData
320054e8 1#include <threads.h>
79a9b408 2#include <time.h>
320054e8
DG
3#include <errno.h>
4#include "syscall.h"
5
6int thrd_sleep(const struct timespec *req, struct timespec *rem)
7{
79a9b408 8 int ret = -__clock_nanosleep(CLOCK_REALTIME, 0, req, rem);
320054e8
DG
9 switch (ret) {
10 case 0: return 0;
11 case -EINTR: return -1; /* value specified by C11 */
12 default: return -2;
13 }
14}