File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ name = "timer"
26
26
harness = false
27
27
28
28
[dependencies ]
29
- async-lock = " 3.0.0"
30
29
cfg-if = " 1"
31
30
concurrent-queue = " 2.2.0"
32
31
futures-io = { version = " 0.3.28" , default-features = false , features = [" std" ] }
Original file line number Diff line number Diff line change 1
1
use std:: cell:: { Cell , RefCell } ;
2
2
use std:: future:: Future ;
3
3
use std:: sync:: atomic:: { AtomicBool , AtomicUsize , Ordering } ;
4
- use std:: sync:: Arc ;
4
+ use std:: sync:: { Arc , OnceLock } ;
5
5
use std:: task:: Waker ;
6
6
use std:: task:: { Context , Poll } ;
7
7
use std:: thread;
8
8
use std:: time:: { Duration , Instant } ;
9
9
10
- use async_lock:: OnceCell ;
11
10
use futures_lite:: pin;
12
11
use parking:: Parker ;
13
12
@@ -18,9 +17,9 @@ static BLOCK_ON_COUNT: AtomicUsize = AtomicUsize::new(0);
18
17
19
18
/// Unparker for the "async-io" thread.
20
19
fn unparker ( ) -> & ' static parking:: Unparker {
21
- static UNPARKER : OnceCell < parking:: Unparker > = OnceCell :: new ( ) ;
20
+ static UNPARKER : OnceLock < parking:: Unparker > = OnceLock :: new ( ) ;
22
21
23
- UNPARKER . get_or_init_blocking ( || {
22
+ UNPARKER . get_or_init ( || {
24
23
let ( parker, unparker) = parking:: pair ( ) ;
25
24
26
25
// Spawn a helper thread driving the reactor.
Original file line number Diff line number Diff line change @@ -8,11 +8,10 @@ use std::mem;
8
8
use std:: panic;
9
9
use std:: pin:: Pin ;
10
10
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
11
- use std:: sync:: { Arc , Mutex , MutexGuard } ;
11
+ use std:: sync:: { Arc , Mutex , MutexGuard , OnceLock } ;
12
12
use std:: task:: { Context , Poll , Waker } ;
13
13
use std:: time:: { Duration , Instant } ;
14
14
15
- use async_lock:: OnceCell ;
16
15
use concurrent_queue:: ConcurrentQueue ;
17
16
use futures_lite:: ready;
18
17
use polling:: { Event , Events , Poller } ;
@@ -93,9 +92,9 @@ pub(crate) struct Reactor {
93
92
impl Reactor {
94
93
/// Returns a reference to the reactor.
95
94
pub ( crate ) fn get ( ) -> & ' static Reactor {
96
- static REACTOR : OnceCell < Reactor > = OnceCell :: new ( ) ;
95
+ static REACTOR : OnceLock < Reactor > = OnceLock :: new ( ) ;
97
96
98
- REACTOR . get_or_init_blocking ( || {
97
+ REACTOR . get_or_init ( || {
99
98
crate :: driver:: init ( ) ;
100
99
Reactor {
101
100
poller : Poller :: new ( ) . expect ( "cannot initialize I/O event notification" ) ,
You can’t perform that action at this time.
0 commit comments