Skip to content

Commit

Permalink
rename task_hooks to scheduler hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah-Kennedy committed Aug 14, 2024
1 parent 4247933 commit af3b7e5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions tokio/src/runtime/scheduler/current_thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) struct Handle {
pub(crate) seed_generator: RngSeedGenerator,

/// User-supplied hooks to invoke for things
pub(crate) scheduler_hooks: TaskHooks,
pub(crate) task_hooks: TaskHooks,
}

/// Data required for executing the scheduler. The struct is passed around to
Expand Down Expand Up @@ -138,7 +138,7 @@ impl CurrentThread {
.unwrap_or(DEFAULT_GLOBAL_QUEUE_INTERVAL);

let handle = Arc::new(Handle {
scheduler_hooks: TaskHooks {
task_hooks: TaskHooks {
task_spawn_callback: config.before_spawn.clone(),
task_terminate_callback: config.after_termination.clone(),
},
Expand Down Expand Up @@ -447,7 +447,7 @@ impl Handle {
{
let (handle, notified) = me.shared.owned.bind(future, me.clone(), id);

me.scheduler_hooks.spawn(&TaskMeta {
me.task_hooks.spawn(&TaskMeta {
#[cfg(tokio_unstable)]
id,
_phantom: Default::default(),
Expand Down Expand Up @@ -619,7 +619,7 @@ impl Schedule for Arc<Handle> {

fn hooks(&self) -> TaskHarnessScheduleHooks {
TaskHarnessScheduleHooks {
task_terminate_callback: self.scheduler_hooks.task_terminate_callback.clone(),
task_terminate_callback: self.task_hooks.task_terminate_callback.clone(),
}
}

Expand Down
6 changes: 3 additions & 3 deletions tokio/src/runtime/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ cfg_rt! {

pub(crate) fn hooks(&self) -> &TaskHooks {
match self {
Handle::CurrentThread(h) => &h.scheduler_hooks,
Handle::CurrentThread(h) => &h.task_hooks,
#[cfg(feature = "rt-multi-thread")]
Handle::MultiThread(h) => &h.scheduler_hooks,
Handle::MultiThread(h) => &h.task_hooks,
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
Handle::MultiThreadAlt(h) => &h.scheduler_hooks,
Handle::MultiThreadAlt(h) => &h.task_hooks,
}
}

Expand Down
4 changes: 2 additions & 2 deletions tokio/src/runtime/scheduler/multi_thread/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(crate) struct Handle {
pub(crate) seed_generator: RngSeedGenerator,

/// User-supplied hooks to invoke for things
pub(crate) scheduler_hooks: TaskHooks,
pub(crate) task_hooks: TaskHooks,
}

impl Handle {
Expand All @@ -55,7 +55,7 @@ impl Handle {
{
let (handle, notified) = me.shared.owned.bind(future, me.clone(), id);

me.scheduler_hooks.spawn(&TaskMeta {
me.task_hooks.spawn(&TaskMeta {
#[cfg(tokio_unstable)]
id,
_phantom: Default::default(),
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/runtime/scheduler/multi_thread/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ pub(super) fn create(

let remotes_len = remotes.len();
let handle = Arc::new(Handle {
scheduler_hooks: TaskHooks {
task_hooks: TaskHooks {
task_spawn_callback: config.before_spawn.clone(),
task_terminate_callback: config.after_termination.clone(),
},
Expand Down Expand Up @@ -1043,7 +1043,7 @@ impl task::Schedule for Arc<Handle> {

fn hooks(&self) -> TaskHarnessScheduleHooks {
TaskHarnessScheduleHooks {
task_terminate_callback: self.scheduler_hooks.task_terminate_callback.clone(),
task_terminate_callback: self.task_hooks.task_terminate_callback.clone(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions tokio/src/runtime/scheduler/multi_thread_alt/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) struct Handle {
pub(crate) seed_generator: RngSeedGenerator,

/// User-supplied hooks to invoke for things
pub(crate) scheduler_hooks: TaskHooks,
pub(crate) task_hooks: TaskHooks,
}

impl Handle {
Expand All @@ -54,7 +54,7 @@ impl Handle {
{
let (handle, notified) = me.shared.owned.bind(future, me.clone(), id);

me.scheduler_hooks.spawn(&TaskMeta {
me.task_hooks.spawn(&TaskMeta {
#[cfg(tokio_unstable)]
id,
_phantom: Default::default(),
Expand Down
10 changes: 5 additions & 5 deletions tokio/src/runtime/scheduler/multi_thread_alt/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ pub(super) fn create(
let (inject, inject_synced) = inject::Shared::new();

let handle = Arc::new(Handle {
scheduler_hooks: TaskHooks {
task_hooks: TaskHooks {
task_spawn_callback: config.before_spawn.clone(),
task_terminate_callback: config.after_termination.clone(),
},
Expand Down Expand Up @@ -1441,7 +1441,7 @@ impl Shared {

fn push_remote_task_batch<I>(&self, iter: I)
where
I: Iterator<Item = task::Notified<Arc<Handle>>>,
I: Iterator<Item=task::Notified<Arc<Handle>>>,
{
unsafe {
self.inject.push_batch(self, iter);
Expand All @@ -1450,7 +1450,7 @@ impl Shared {

fn push_remote_task_batch_synced<I>(&self, synced: &mut Synced, iter: I)
where
I: Iterator<Item = task::Notified<Arc<Handle>>>,
I: Iterator<Item=task::Notified<Arc<Handle>>>,
{
unsafe {
self.inject.push_batch(&mut synced.inject, iter);
Expand Down Expand Up @@ -1525,7 +1525,7 @@ impl Overflow<Arc<Handle>> for Shared {

fn push_batch<I>(&self, iter: I)
where
I: Iterator<Item = task::Notified<Arc<Handle>>>,
I: Iterator<Item=task::Notified<Arc<Handle>>>,
{
self.push_remote_task_batch(iter)
}
Expand Down Expand Up @@ -1562,7 +1562,7 @@ impl task::Schedule for Arc<Handle> {

fn hooks(&self) -> TaskHarnessScheduleHooks {
TaskHarnessScheduleHooks {
task_terminate_callback: self.scheduler_hooks.task_terminate_callback.clone(),
task_terminate_callback: self.task_hooks.task_terminate_callback.clone(),
}
}

Expand Down

0 comments on commit af3b7e5

Please sign in to comment.