mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
Merge pull request #126 from dwrensha/slab-capacity-one
initialize slabs with capacity of one
This commit is contained in:
+3
-5
@@ -35,8 +35,6 @@ pub use self::interval::Interval;
|
|||||||
static NEXT_LOOP_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
static NEXT_LOOP_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||||
scoped_thread_local!(static CURRENT_LOOP: Core);
|
scoped_thread_local!(static CURRENT_LOOP: Core);
|
||||||
|
|
||||||
const SLAB_CAPACITY: usize = 1024 * 64;
|
|
||||||
|
|
||||||
/// An event loop.
|
/// An event loop.
|
||||||
///
|
///
|
||||||
/// The event loop is the main source of blocking in an application which drives
|
/// The event loop is the main source of blocking in an application which drives
|
||||||
@@ -154,9 +152,9 @@ impl Core {
|
|||||||
inner: Rc::new(RefCell::new(Inner {
|
inner: Rc::new(RefCell::new(Inner {
|
||||||
id: NEXT_LOOP_ID.fetch_add(1, Ordering::Relaxed),
|
id: NEXT_LOOP_ID.fetch_add(1, Ordering::Relaxed),
|
||||||
io: io,
|
io: io,
|
||||||
io_dispatch: Slab::with_capacity(SLAB_CAPACITY),
|
io_dispatch: Slab::with_capacity(1),
|
||||||
task_dispatch: Slab::with_capacity(SLAB_CAPACITY),
|
task_dispatch: Slab::with_capacity(1),
|
||||||
timeouts: Slab::with_capacity(SLAB_CAPACITY),
|
timeouts: Slab::with_capacity(1),
|
||||||
timer_heap: Heap::new(),
|
timer_heap: Heap::new(),
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user