rust/library/std/src/sys/sgx/thread_local_key.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
472 B
Rust
Raw Normal View History

2018-08-28 04:40:08 +00:00
use super::abi::tls::{Key as AbiKey, Tls};
pub type Key = usize;
#[inline]
pub unsafe fn create(dtor: Option<unsafe extern "C" fn(*mut u8)>) -> Key {
2018-08-28 04:40:08 +00:00
Tls::create(dtor).as_usize()
}
#[inline]
pub unsafe fn set(key: Key, value: *mut u8) {
2018-08-28 04:40:08 +00:00
Tls::set(AbiKey::from_usize(key), value)
}
#[inline]
pub unsafe fn get(key: Key) -> *mut u8 {
2018-08-28 04:40:08 +00:00
Tls::get(AbiKey::from_usize(key))
}
#[inline]
pub unsafe fn destroy(key: Key) {
2018-08-28 04:40:08 +00:00
Tls::destroy(AbiKey::from_usize(key))
}