mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Clean up some sleep code
This commit is contained in:
parent
9849b4c7ba
commit
672ccda37c
35 changed files with 310 additions and 598 deletions
|
@ -17,6 +17,8 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
/**
|
||||
|
@ -28,7 +30,7 @@
|
|||
* @norestart
|
||||
*/
|
||||
int usleep(uint32_t micros) {
|
||||
struct timespec ts;
|
||||
ts = _timespec_frommicros(micros);
|
||||
return nanosleep(&ts, 0);
|
||||
struct timespec ts = _timespec_frommicros(micros);
|
||||
if (clock_nanosleep(CLOCK_REALTIME, 0, &ts, 0)) return eintr();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue