summaryrefslogtreecommitdiff
path: root/lib/libc/thread/thrd_sleep.c
blob: 075431e35970b468a0b77dbfc92298ffb9d94967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}