1 /* -*- c-basic-offset: 8; -*- */
9 sleep_us(unsigned int nusecs
)
14 tval
.tv_sec
= nusecs
/ 1000000;
15 tval
.tv_usec
= nusecs
% 1000000;
16 if (select(0, NULL
, NULL
, NULL
, &tval
) == 0)
19 * Note than on an interrupted system call (i.e, SIGIO) there's not
20 * much we can do, since the timeval{} isn't updated with the time
21 * remaining. We could obtain the clock time before the call, and
22 * then obtain the clock time here, subtracting them to determine
23 * how long select() blocked before it was interrupted, but that
24 * seems like too much work :-)
28 err_sys("sleep_us: select error");