From d8bd8de82e19702ad26fff704ff9a4890ebe1bf7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 4 Mar 2014 17:40:45 -0800 Subject: native: Move from usleep() to nanosleep() Using nanosleep() allows us to gracefully recover from EINTR because on error it fills in the second parameter with the remaining time to sleep. Closes #12689 --- src/libstd/libc.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index 7096765d9fc..d10fa7684e8 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -3682,6 +3682,7 @@ pub mod funcs { use libc::types::common::c95::c_void; use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint}; use libc::types::os::arch::c95::{size_t}; + use libc::types::os::common::posix01::timespec; use libc::types::os::arch::posix01::utimbuf; use libc::types::os::arch::posix88::{gid_t, off_t, pid_t}; use libc::types::os::arch::posix88::{ssize_t, uid_t}; @@ -3731,6 +3732,7 @@ pub mod funcs { pub fn setuid(uid: uid_t) -> c_int; pub fn sleep(secs: c_uint) -> c_uint; pub fn usleep(secs: c_uint) -> c_int; + pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int; pub fn sysconf(name: c_int) -> c_long; pub fn tcgetpgrp(fd: c_int) -> pid_t; pub fn ttyname(fd: c_int) -> *c_char; -- cgit 1.4.1-3-g733a5