about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-08-06 13:53:38 +0200
committerRalf Jung <post@ralfj.de>2018-08-06 13:53:38 +0200
commitab3e4a27894295ec0fca28b492450f2b22fbad4e (patch)
treec9832356425aeac026b258f49aedc6a13667671d
parent22457deef7e4205b46127fbbe4d0c720aa60b999 (diff)
downloadrust-ab3e4a27894295ec0fca28b492450f2b22fbad4e.tar.gz
rust-ab3e4a27894295ec0fca28b492450f2b22fbad4e.zip
argue why at_exit_imp is fine
-rw-r--r--src/libstd/sys_common/at_exit_imp.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/sys_common/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs
index 633605039af..30019088eb6 100644
--- a/src/libstd/sys_common/at_exit_imp.rs
+++ b/src/libstd/sys_common/at_exit_imp.rs
@@ -64,6 +64,7 @@ pub fn cleanup() {
             if !queue.is_null() {
                 let queue: Box<Queue> = Box::from_raw(queue);
                 for to_run in *queue {
+                    // We are not holding any lock, so reentrancy is fine.
                     to_run();
                 }
             }
@@ -75,9 +76,8 @@ pub fn push(f: Box<dyn FnBox()>) -> bool {
     unsafe {
         let _guard = LOCK.lock();
         if init() {
-            // This could reentrantly call `push` again, which is a problem because
-            // `LOCK` allows reentrancy!
-            // FIXME: Add argument why this is okay.
+            // We are just moving `f` around, not calling it.
+            // There is no possibility of reentrancy here.
             (*QUEUE).push(f);
             true
         } else {