diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2016-08-29 10:53:12 +0200 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2016-08-29 10:53:12 +0200 |
| commit | 59e5e0b2db2ab66f138044bde80c44c7f9391a00 (patch) | |
| tree | 649d3a360c2de9f60d83b1c3e270ef421e374bb3 /src/libstd/sys | |
| parent | 8dae1b662588ed18017a50c2cbc5c6b2880ae27c (diff) | |
| download | rust-59e5e0b2db2ab66f138044bde80c44c7f9391a00.tar.gz rust-59e5e0b2db2ab66f138044bde80c44c7f9391a00.zip | |
Avoid using pthread_condattr_setclock on Android.
The pthread_condattr_setclock is available only since Android 5.0 and API level 21.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/condvar.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 725a071a4f9..27b9f131d12 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -30,10 +30,10 @@ impl Condvar { Condvar { inner: UnsafeCell::new(libc::PTHREAD_COND_INITIALIZER) } } - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android"))] pub unsafe fn init(&mut self) {} - #[cfg(not(any(target_os = "macos", target_os = "ios")))] + #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] pub unsafe fn init(&mut self) { use mem; let mut attr: libc::pthread_condattr_t = mem::uninitialized(); @@ -69,7 +69,7 @@ impl Condvar { // where we configure condition variable to use monotonic clock (instead of // default system clock). This approach avoids all problems that result // from changes made to the system time. - #[cfg(not(any(target_os = "macos", target_os = "ios")))] + #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { use mem; @@ -99,7 +99,7 @@ impl Condvar { // This implementation is modeled after libcxx's condition_variable // https://github.com/llvm-mirror/libcxx/blob/release_35/src/condition_variable.cpp#L46 // https://github.com/llvm-mirror/libcxx/blob/release_35/include/__mutex_base#L367 - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android"))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { use ptr; use time::Instant; |
