We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 22457de commit ab3e4a2Copy full SHA for ab3e4a2
src/libstd/sys_common/at_exit_imp.rs
@@ -64,6 +64,7 @@ pub fn cleanup() {
64
if !queue.is_null() {
65
let queue: Box<Queue> = Box::from_raw(queue);
66
for to_run in *queue {
67
+ // We are not holding any lock, so reentrancy is fine.
68
to_run();
69
}
70
@@ -75,9 +76,8 @@ pub fn push(f: Box<dyn FnBox()>) -> bool {
75
76
unsafe {
77
let _guard = LOCK.lock();
78
if init() {
- // This could reentrantly call `push` again, which is a problem because
79
- // `LOCK` allows reentrancy!
80
- // FIXME: Add argument why this is okay.
+ // We are just moving `f` around, not calling it.
+ // There is no possibility of reentrancy here.
81
(*QUEUE).push(f);
82
true
83
} else {
0 commit comments