pub struct StaticKey {
key: AtomicU32,
dtor: Option<unsafe extern "C" fn(_: *mut u8)>,
next: AtomicPtr<StaticKey>,
once: UnsafeCell<RTL_RUN_ONCE>,
}
Fields§
§key: AtomicU32
The key value shifted up by one. Since TLS_OUT_OF_INDEXES == DWORD::MAX is not a valid key value, this allows us to use zero as sentinel value without risking overflow.
dtor: Option<unsafe extern "C" fn(_: *mut u8)>
§next: AtomicPtr<StaticKey>
§once: UnsafeCell<RTL_RUN_ONCE>
Currently, destructors cannot be unregistered, so we cannot use racy
initialization for keys. Instead, we need synchronize initialization.
Use the Windows-provided Once
since it does not require TLS.
Implementations§
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more