about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-08-06 12:45:27 +0200
committerRalf Jung <post@ralfj.de>2018-08-06 12:54:44 +0200
commitd3d31105e99f5265880d0f010436ed5c6baab034 (patch)
tree02ea7c780c9e844e81763cecc19b9c9ec8604391 /src/libstd/thread
parent7c98d2e63f732682b057c8c453b08f9e12b262e6 (diff)
downloadrust-d3d31105e99f5265880d0f010436ed5c6baab034.tar.gz
rust-d3d31105e99f5265880d0f010436ed5c6baab034.zip
clarify partially initialized Mutex issues
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index bbe80df7e8b..98b4ca36c26 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -940,6 +940,9 @@ pub struct ThreadId(u64);
 impl ThreadId {
     // Generate a new unique thread ID.
     fn new() -> ThreadId {
+        // `GUARD` 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 GUARD: mutex::Mutex = mutex::Mutex::new();
         static mut COUNTER: u64 = 0;