Welcome to mirror list, hosted at ThFree Co, Russian Federation.

nanosleep.c « riscv « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1a247109cee851fe3389be0704a37088fc6fc26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <machine/syscall.h>
#include <sys/time.h>

int
nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
  unsigned long current_time, end_time;
  asm ("rdtime %0" : "+r" (current_time));
  end_time = current_time + rqtp->tv_sec * 1000000000ULL + rqtp->tv_nsec;
  while (current_time <= end_time) asm ("rdtime %0" : "+r" (current_time));
  return 0;
}