thrd_sleep.c 300 B

12345678910111213
  1. #include <threads.h>
  2. #include <errno.h>
  3. #include "syscall.h"
  4. int thrd_sleep(const struct timespec *req, struct timespec *rem)
  5. {
  6. int ret = __syscall(SYS_nanosleep, req, rem);
  7. switch (ret) {
  8. case 0: return 0;
  9. case -EINTR: return -1; /* value specified by C11 */
  10. default: return -2;
  11. }
  12. }