@@ -34,10 +34,10 @@ use crate::process::kill::Kill;
34
34
use crate :: process:: SpawnedChild ;
35
35
use crate :: signal:: unix:: driver:: Handle as SignalHandle ;
36
36
use crate :: signal:: unix:: { signal, Signal , SignalKind } ;
37
+ use crate :: util:: once_cell:: OnceCell ;
37
38
38
39
use mio:: event:: Source ;
39
40
use mio:: unix:: SourceFd ;
40
- use once_cell:: sync:: Lazy ;
41
41
use std:: fmt;
42
42
use std:: fs:: File ;
43
43
use std:: future:: Future ;
@@ -64,25 +64,29 @@ impl Kill for StdChild {
64
64
}
65
65
}
66
66
67
- static ORPHAN_QUEUE : Lazy < OrphanQueueImpl < StdChild > > = Lazy :: new ( OrphanQueueImpl :: new) ;
67
+ fn get_orphan_queue ( ) -> & ' static OrphanQueueImpl < StdChild > {
68
+ static ORPHAN_QUEUE : OnceCell < OrphanQueueImpl < StdChild > > = OnceCell :: new ( ) ;
69
+
70
+ ORPHAN_QUEUE . get ( OrphanQueueImpl :: new)
71
+ }
68
72
69
73
pub ( crate ) struct GlobalOrphanQueue ;
70
74
71
75
impl fmt:: Debug for GlobalOrphanQueue {
72
76
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
73
- ORPHAN_QUEUE . fmt ( fmt)
77
+ get_orphan_queue ( ) . fmt ( fmt)
74
78
}
75
79
}
76
80
77
81
impl GlobalOrphanQueue {
78
82
fn reap_orphans ( handle : & SignalHandle ) {
79
- ORPHAN_QUEUE . reap_orphans ( handle)
83
+ get_orphan_queue ( ) . reap_orphans ( handle)
80
84
}
81
85
}
82
86
83
87
impl OrphanQueue < StdChild > for GlobalOrphanQueue {
84
88
fn push_orphan ( & self , orphan : StdChild ) {
85
- ORPHAN_QUEUE . push_orphan ( orphan)
89
+ get_orphan_queue ( ) . push_orphan ( orphan)
86
90
}
87
91
}
88
92
0 commit comments