mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
runtime: clean up magic number in registration set (#7112)
This commit is contained in:
parent
a82bdeebe9
commit
21a13f9eea
@ -7,6 +7,9 @@ use std::ptr::NonNull;
|
||||
use std::sync::atomic::Ordering::{Acquire, Release};
|
||||
use std::sync::Arc;
|
||||
|
||||
// Kind of arbitrary, but buffering 16 `ScheduledIo`s doesn't seem like much
|
||||
const NOTIFY_AFTER: usize = 16;
|
||||
|
||||
pub(super) struct RegistrationSet {
|
||||
num_pending_release: AtomicUsize,
|
||||
}
|
||||
@ -35,7 +38,7 @@ impl RegistrationSet {
|
||||
let synced = Synced {
|
||||
is_shutdown: false,
|
||||
registrations: LinkedList::new(),
|
||||
pending_release: Vec::with_capacity(16),
|
||||
pending_release: Vec::with_capacity(NOTIFY_AFTER),
|
||||
};
|
||||
|
||||
(set, synced)
|
||||
@ -69,9 +72,6 @@ impl RegistrationSet {
|
||||
// Returns `true` if the caller should unblock the I/O driver to purge
|
||||
// registrations pending release.
|
||||
pub(super) fn deregister(&self, synced: &mut Synced, registration: &Arc<ScheduledIo>) -> bool {
|
||||
// Kind of arbitrary, but buffering 16 `ScheduledIo`s doesn't seem like much
|
||||
const NOTIFY_AFTER: usize = 16;
|
||||
|
||||
synced.pending_release.push(registration.clone());
|
||||
|
||||
let len = synced.pending_release.len();
|
||||
|
Loading…
x
Reference in New Issue
Block a user