@@ -15,7 +15,7 @@ use concurrent_queue::ConcurrentQueue;
15
15
use futures_lite:: future;
16
16
use once_cell:: sync:: Lazy ;
17
17
use polling:: { Event , Poller } ;
18
- use vec_arena :: Arena ;
18
+ use slab :: Slab ;
19
19
20
20
const READ : usize = 0 ;
21
21
const WRITE : usize = 1 ;
@@ -38,7 +38,7 @@ pub(crate) struct Reactor {
38
38
ticker : AtomicUsize ,
39
39
40
40
/// Registered sources.
41
- sources : Mutex < Arena < Arc < Source > > > ,
41
+ sources : Mutex < Slab < Arc < Source > > > ,
42
42
43
43
/// Temporary storage for I/O events when polling the reactor.
44
44
///
@@ -67,7 +67,7 @@ impl Reactor {
67
67
Reactor {
68
68
poller : Poller :: new ( ) . expect ( "cannot initialize I/O event notification" ) ,
69
69
ticker : AtomicUsize :: new ( 0 ) ,
70
- sources : Mutex :: new ( Arena :: new ( ) ) ,
70
+ sources : Mutex :: new ( Slab :: new ( ) ) ,
71
71
events : Mutex :: new ( Vec :: new ( ) ) ,
72
72
timers : Mutex :: new ( BTreeMap :: new ( ) ) ,
73
73
timer_ops : ConcurrentQueue :: bounded ( 1000 ) ,
@@ -90,7 +90,7 @@ impl Reactor {
90
90
// Create an I/O source for this file descriptor.
91
91
let source = {
92
92
let mut sources = self . sources . lock ( ) . unwrap ( ) ;
93
- let key = sources. next_vacant ( ) ;
93
+ let key = sources. vacant_entry ( ) . key ( ) ;
94
94
let source = Arc :: new ( Source {
95
95
raw,
96
96
key,
@@ -362,7 +362,7 @@ struct Direction {
362
362
/// Wakers of tasks waiting for the next event.
363
363
///
364
364
/// Registered by `Async::readable()` and `Async::writable()`.
365
- wakers : Arena < Option < Waker > > ,
365
+ wakers : Slab < Option < Waker > > ,
366
366
}
367
367
368
368
impl Direction {
0 commit comments