Auto merge of #102655 - joboet:windows_tls_opt, r=ChrisDenton

Optimize TLS on Windows

This implements the suggestion in the current TLS code to embed the linked list of destructors in the `StaticKey` structure to save allocations. Additionally, locking is avoided when no destructor needs to be run. By using one Windows-provided `Once` per key instead of a global lock, locking is more finely-grained (this unblocks #100579).
This commit is contained in:
bors 2022-10-13 06:49:29 +00:00
commit fa0ca783f8
9 changed files with 206 additions and 121 deletions

View file

@ -19,8 +19,3 @@ pub unsafe fn get(_key: Key) -> *mut u8 {
pub unsafe fn destroy(_key: Key) {
panic!("should not be used on the solid target");
}
#[inline]
pub fn requires_synchronized_create() -> bool {
panic!("should not be used on the solid target");
}