diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2014-05-14 15:54:19 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-15 13:50:36 -0700 |
| commit | e043644cea119ea701a293a01b6d4c5c0f13f450 (patch) | |
| tree | fb99bf6af2490e2f830a96f1daab8f788802e9b3 /src/libstd/rt | |
| parent | 8211539114df8b6e3a9b8b251fa57cb5a77d2f14 (diff) | |
| download | rust-e043644cea119ea701a293a01b6d4c5c0f13f450.tar.gz rust-e043644cea119ea701a293a01b6d4c5c0f13f450.zip | |
use sched_yield on linux and freebsd
pthread_yield is non-standard, while sched_yield is POSIX The Linux documentation recommends using the standard function. This is the only feature we're currently using that's present in glibc but not in musl.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/thread.rs | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs index 4f0d7d35ce8..e25fa4734d5 100644 --- a/src/libstd/rt/thread.rs +++ b/src/libstd/rt/thread.rs @@ -273,13 +273,8 @@ mod imp { assert_eq!(pthread_detach(native), 0); } - #[cfg(target_os = "macos")] - #[cfg(target_os = "android")] pub unsafe fn yield_now() { assert_eq!(sched_yield(), 0); } - #[cfg(not(target_os = "macos"), not(target_os = "android"))] - pub unsafe fn yield_now() { assert_eq!(pthread_yield(), 0); } - // glibc >= 2.15 has a __pthread_get_minstack() function that returns // PTHREAD_STACK_MIN plus however many bytes are needed for thread-local // storage. We need that information to avoid blowing up when a small stack @@ -326,12 +321,7 @@ mod imp { fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t, state: libc::c_int) -> libc::c_int; fn pthread_detach(thread: libc::pthread_t) -> libc::c_int; - - #[cfg(target_os = "macos")] - #[cfg(target_os = "android")] fn sched_yield() -> libc::c_int; - #[cfg(not(target_os = "macos"), not(target_os = "android"))] - fn pthread_yield() -> libc::c_int; } } |
