Macro sgx_tstd::thread_local [−][src]
macro_rules! thread_local { () => { ... }; ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => { ... }; ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => { ... }; }
Declare a new thread local storage key of type [sgx_trts::LocalKey
].
Syntax
The macro wraps any number of static declarations and makes them thread local. Publicity and attributes for each static are allowed. Example:
use core::cell::RefCell; thread_local! { pub static FOO: RefCell<u32> = RefCell::new(1); #[allow(unused)] static BAR: RefCell<f32> = RefCell::new(1.0); }