diff options
Diffstat (limited to 'lib/libc/thread/thrd_sleep.c')
| -rw-r--r-- | lib/libc/thread/thrd_sleep.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/thread/thrd_sleep.c b/lib/libc/thread/thrd_sleep.c new file mode 100644 index 00000000..075431e3 --- /dev/null +++ b/lib/libc/thread/thrd_sleep.c @@ -0,0 +1,17 @@ +#include <errno.h> +#include <syscall.h> +#include <threads.h> +#include <time.h> + +int thrd_sleep(const struct timespec *duration, struct timespec *remaining) +{ + int r = __syscall(nanosleep, CLOCK_REALTIME, 0, duration, remaining); + + if (r == 0) + return 0; + + if (r == EINTR) + return -1; + + return -2; +} |
