Commit 8507e28 1 parent 7efcab4 commit 8507e28 Copy full SHA for 8507e28
File tree 5 files changed +10
-83
lines changed
5 files changed +10
-83
lines changed Original file line number Diff line number Diff line change 1
1
use super :: AtomicU64 ;
2
2
use crate :: loom:: sync:: { atomic:: Ordering , Mutex } ;
3
- use crate :: util :: once_cell :: OnceCell ;
3
+ use std :: sync :: OnceLock ;
4
4
5
5
pub ( crate ) struct StaticAtomicU64 {
6
6
init : u64 ,
7
- cell : OnceCell < Mutex < u64 > > ,
7
+ cell : OnceLock < Mutex < u64 > > ,
8
8
}
9
9
10
10
impl AtomicU64 {
@@ -19,7 +19,7 @@ impl StaticAtomicU64 {
19
19
pub ( crate ) const fn new ( val : u64 ) -> StaticAtomicU64 {
20
20
StaticAtomicU64 {
21
21
init : val,
22
- cell : OnceCell :: new ( ) ,
22
+ cell : OnceLock :: new ( ) ,
23
23
}
24
24
}
25
25
@@ -52,6 +52,6 @@ impl StaticAtomicU64 {
52
52
}
53
53
54
54
fn inner ( & self ) -> & Mutex < u64 > {
55
- self . cell . get ( || Mutex :: new ( self . init ) )
55
+ self . cell . get_or_init ( || Mutex :: new ( self . init ) )
56
56
}
57
57
}
Original file line number Diff line number Diff line change @@ -66,11 +66,11 @@ impl Kill for StdChild {
66
66
67
67
cfg_not_has_const_mutex_new ! {
68
68
fn get_orphan_queue( ) -> & ' static OrphanQueueImpl <StdChild > {
69
- use crate :: util :: once_cell :: OnceCell ;
69
+ use std :: sync :: OnceLock ;
70
70
71
- static ORPHAN_QUEUE : OnceCell <OrphanQueueImpl <StdChild >> = OnceCell :: new( ) ;
71
+ static ORPHAN_QUEUE : OnceLock <OrphanQueueImpl <StdChild >> = OnceLock :: new( ) ;
72
72
73
- ORPHAN_QUEUE . get ( OrphanQueueImpl :: new)
73
+ ORPHAN_QUEUE . get_or_init ( OrphanQueueImpl :: new)
74
74
}
75
75
}
76
76
Original file line number Diff line number Diff line change 1
1
use crate :: signal:: os:: { OsExtraData , OsStorage } ;
2
2
use crate :: sync:: watch;
3
- use crate :: util:: once_cell:: OnceCell ;
4
3
5
4
use std:: ops;
6
5
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
6
+ use std:: sync:: OnceLock ;
7
7
8
8
pub ( crate ) type EventId = usize ;
9
9
@@ -164,9 +164,9 @@ where
164
164
OsExtraData : ' static + Send + Sync + Init ,
165
165
OsStorage : ' static + Send + Sync + Init ,
166
166
{
167
- static GLOBALS : OnceCell < Globals > = OnceCell :: new ( ) ;
167
+ static GLOBALS : OnceLock < Globals > = OnceLock :: new ( ) ;
168
168
169
- GLOBALS . get ( globals_init)
169
+ GLOBALS . get_or_init ( globals_init)
170
170
}
171
171
172
172
#[ cfg( all( test, not( loom) ) ) ]
Original file line number Diff line number Diff line change @@ -13,9 +13,6 @@ pub(crate) use blocking_check::check_socket_for_blocking;
13
13
14
14
pub ( crate ) mod metric_atomics;
15
15
16
- #[ cfg( any( feature = "rt" , feature = "signal" , feature = "process" ) ) ]
17
- pub ( crate ) mod once_cell;
18
-
19
16
#[ cfg( any(
20
17
// io driver uses `WakeList` directly
21
18
feature = "net" ,
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments