aboutsummaryrefslogtreecommitdiff
path: root/src/thread/thrd_sleep.c
blob: 18b09a3a4a52faafb27327328e459ad2d791ba7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <threads.h>
#include <time.h>
#include <errno.h>
#include "syscall.h"

int thrd_sleep(const struct timespec *req, struct timespec *rem)
{
	int ret = -__clock_nanosleep(CLOCK_REALTIME, 0, req, rem);
	switch (ret) {
	case 0:      return 0;
	case -EINTR: return -1; /* value specified by C11 */
	default:     return -2;
	}
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif