Skip to content

Commit 3cbe037

Browse files
committed
fix deadlock
1 parent 1978131 commit 3cbe037

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/process.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ impl Process {
204204
// TODO: child subreaper
205205
let reaper = INIT_PROC.get().unwrap();
206206

207+
if Arc::ptr_eq(self, reaper) {
208+
return;
209+
}
210+
207211
let mut children = self.children.lock(); // Acquire the lock first
208212
self.is_zombie.store(true, Ordering::Release);
209213

tests/process.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ fn free_not_zombie() {
2828
init_proc().new_child().free();
2929
}
3030

31-
#[test]
32-
#[should_panic]
33-
fn init_proc_exit() {
34-
init_proc().exit();
35-
}
36-
3731
#[test]
3832
fn free() {
3933
let parent = init_proc().new_child();

0 commit comments

Comments
 (0)