Rollup merge of #103017 - fortanix:raoul/sgx_tls_fix, r=ChrisDenton

Avoid dropping TLS Key on sgx

#102655 reenabled dropping thread local `Key` on every platform ([library/std/src/sys_common/thread_local_key.rs](fa0ca783f8 (diff-5cb9acf9e243f35c975fa9fbac4885519dc104626bc03610dfa7a20bc79641ceL237-R215))). That's causing problems at least for sgx.

cc: `@jethrogb` `@ChrisDenton`
This commit is contained in:
Matthias Krüger 2022-10-14 23:43:43 +02:00 committed by GitHub
commit d47b755683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,6 +111,7 @@ impl Tls {
rtabort!("TLS limit exceeded")
};
TLS_DESTRUCTOR[index].store(dtor.map_or(0, |f| f as usize), Ordering::Relaxed);
unsafe { Self::current() }.data[index].set(ptr::null_mut());
Key::from_index(index)
}