@@ -34,10 +34,10 @@ use crate::process::kill::Kill;
3434use crate :: process:: SpawnedChild ;
3535use crate :: signal:: unix:: driver:: Handle as SignalHandle ;
3636use crate :: signal:: unix:: { signal, Signal , SignalKind } ;
37+ use crate :: util:: once_cell:: OnceCell ;
3738
3839use mio:: event:: Source ;
3940use mio:: unix:: SourceFd ;
40- use once_cell:: sync:: Lazy ;
4141use std:: fmt;
4242use std:: fs:: File ;
4343use std:: future:: Future ;
@@ -64,25 +64,29 @@ impl Kill for StdChild {
6464 }
6565}
6666
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+ }
6872
6973pub ( crate ) struct GlobalOrphanQueue ;
7074
7175impl fmt:: Debug for GlobalOrphanQueue {
7276 fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
73- ORPHAN_QUEUE . fmt ( fmt)
77+ get_orphan_queue ( ) . fmt ( fmt)
7478 }
7579}
7680
7781impl GlobalOrphanQueue {
7882 fn reap_orphans ( handle : & SignalHandle ) {
79- ORPHAN_QUEUE . reap_orphans ( handle)
83+ get_orphan_queue ( ) . reap_orphans ( handle)
8084 }
8185}
8286
8387impl OrphanQueue < StdChild > for GlobalOrphanQueue {
8488 fn push_orphan ( & self , orphan : StdChild ) {
85- ORPHAN_QUEUE . push_orphan ( orphan)
89+ get_orphan_queue ( ) . push_orphan ( orphan)
8690 }
8791}
8892
0 commit comments