提交 5bcf2a92 编写于 作者: A Alex Crichton

rollup merge of #22177: semarie/openbsd-notls

OpenBSD doesn't have thread-local-storage support (yet).
Permit to compile (and run) `check-stage1-crates` under OpenBSD.
......@@ -81,6 +81,7 @@ pub struct Key<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
#[cfg_attr(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64")),
thread_local)]
static $name: ::std::thread_local::scoped::Key<$t> =
......@@ -90,6 +91,7 @@ pub struct Key<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
#[cfg_attr(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64")),
thread_local)]
pub static $name: ::std::thread_local::scoped::Key<$t> =
......@@ -98,14 +100,22 @@ pub struct Key<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
($t:ty) => ({
use std::thread_local::scoped::Key as __Key;
#[cfg(not(any(windows, target_os = "android", target_os = "ios", target_arch = "aarch64")))]
#[cfg(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64")))]
const _INIT: __Key<$t> = __Key {
inner: ::std::thread_local::scoped::__impl::KeyInner {
inner: ::std::cell::UnsafeCell { value: 0 as *mut _ },
}
};
#[cfg(any(windows, target_os = "android", target_os = "ios", target_arch = "aarch64"))]
#[cfg(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64"))]
const _INIT: __Key<$t> = __Key {
inner: ::std::thread_local::scoped::__impl::KeyInner {
inner: ::std::thread_local::scoped::__impl::OS_INIT,
......@@ -205,7 +215,11 @@ pub fn is_set(&'static self) -> bool {
}
}
#[cfg(not(any(windows, target_os = "android", target_os = "ios", target_arch = "aarch64")))]
#[cfg(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64")))]
mod imp {
use std::cell::UnsafeCell;
......@@ -223,7 +237,11 @@ pub unsafe fn get(&self) -> *mut T { *self.inner.get() }
}
}
#[cfg(any(windows, target_os = "android", target_os = "ios", target_arch = "aarch64"))]
#[cfg(any(windows,
target_os = "android",
target_os = "ios",
target_os = "openbsd",
target_arch = "aarch64"))]
mod imp {
use marker;
use sys_common::thread_local::StaticKey as OsStaticKey;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册