diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-05 16:58:42 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-13 17:27:42 -0700 |
| commit | f09592a5d154177f0c9d739c9fe60742ec4cd951 (patch) | |
| tree | 79540b4f5f7e125a260b9ca00f25e796241425f9 /src/liblibc | |
| parent | 9f7caed2024268f6de16f99b6696d191f3ca3228 (diff) | |
| download | rust-f09592a5d154177f0c9d739c9fe60742ec4cd951.tar.gz rust-f09592a5d154177f0c9d739c9fe60742ec4cd951.zip | |
io: Implement process wait timeouts
This implements set_timeout() for std::io::Process which will affect wait() operations on the process. This follows the same pattern as the rest of the timeouts emerging in std::io::net. The implementation was super easy for everything except libnative on unix (backwards from usual!), which required a good bit of signal handling. There's a doc comment explaining the strategy in libnative. Internally, this also required refactoring the "helper thread" implementation used by libnative to allow for an extra helper thread (not just the timer). This is a breaking change in terms of the io::Process API. It is now possible for wait() to fail, and subsequently wait_with_output(). These two functions now return IoResult<T> due to the fact that they can time out. Additionally, the wait_with_output() function has moved from taking `&mut self` to taking `self`. If a timeout occurs while waiting with output, the semantics are undesirable in almost all cases if attempting to re-wait on the process. Equivalent functionality can still be achieved by dealing with the output handles manually. [breaking-change] cc #13523
Diffstat (limited to 'src/liblibc')
| -rw-r--r-- | src/liblibc/lib.rs | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index a35ebb06437..1edd99c1d7d 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -173,7 +173,7 @@ pub use funcs::bsd43::{shutdown}; #[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK}; #[cfg(unix)] pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS}; #[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE}; -#[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, WNOHANG}; +#[cfg(unix)] pub use consts::os::posix01::{SIG_IGN}; #[cfg(unix)] pub use consts::os::bsd44::{AF_UNIX}; #[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec, timezone}; @@ -2473,8 +2473,6 @@ pub mod consts { pub static CLOCK_REALTIME: c_int = 0; pub static CLOCK_MONOTONIC: c_int = 1; - - pub static WNOHANG: c_int = 1; } pub mod posix08 { } @@ -2924,8 +2922,6 @@ pub mod consts { pub static CLOCK_REALTIME: c_int = 0; pub static CLOCK_MONOTONIC: c_int = 4; - - pub static WNOHANG: c_int = 1; } pub mod posix08 { } @@ -3313,8 +3309,6 @@ pub mod consts { pub static PTHREAD_CREATE_JOINABLE: c_int = 1; pub static PTHREAD_CREATE_DETACHED: c_int = 2; pub static PTHREAD_STACK_MIN: size_t = 8192; - - pub static WNOHANG: c_int = 1; } pub mod posix08 { } @@ -3980,16 +3974,6 @@ pub mod funcs { } } - pub mod wait { - use types::os::arch::c95::{c_int}; - use types::os::arch::posix88::{pid_t}; - - extern { - pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) - -> pid_t; - } - } - pub mod glob { use types::os::arch::c95::{c_char, c_int}; use types::os::common::posix01::{glob_t}; |
