diff options
| author | Ralf Jung <post@ralfj.de> | 2018-08-06 12:45:27 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-08-06 12:54:44 +0200 |
| commit | d3d31105e99f5265880d0f010436ed5c6baab034 (patch) | |
| tree | 02ea7c780c9e844e81763cecc19b9c9ec8604391 /src/libstd/sys_common/thread_local.rs | |
| parent | 7c98d2e63f732682b057c8c453b08f9e12b262e6 (diff) | |
| download | rust-d3d31105e99f5265880d0f010436ed5c6baab034.tar.gz rust-d3d31105e99f5265880d0f010436ed5c6baab034.zip | |
clarify partially initialized Mutex issues
Diffstat (limited to 'src/libstd/sys_common/thread_local.rs')
| -rw-r--r-- | src/libstd/sys_common/thread_local.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs index 75f6b9ac7fd..2cc5372e268 100644 --- a/src/libstd/sys_common/thread_local.rs +++ b/src/libstd/sys_common/thread_local.rs @@ -161,6 +161,9 @@ impl StaticKey { // Additionally a 0-index of a tls key hasn't been seen on windows, so // we just simplify the whole branch. if imp::requires_synchronized_create() { + // `INIT_LOCK` is never initialized fully, so this mutex is reentrant! + // Do not use it in a way that might be reentrant, that could lead to + // aliasing `&mut`. static INIT_LOCK: Mutex = Mutex::new(); let _guard = INIT_LOCK.lock(); let mut key = self.key.load(Ordering::SeqCst); |
