mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
rt: split internal runtime::Handle concerns (#5022)
The `runtime::Handle` struct is part of the public API but is also used internally. This has created a bit of tension. An earlier patch made defined Handle as a private struct in some cases when `rt` is not enabled. This patch splits out internal handle concerns into a new `scheduler::Handle` type, which will only be internal. This also defines a `Handle` type for each scheduler variant. Eventually, the per-scheduler `Handle` types will replace the per-scheduler `Spawner` types, but more work is needed before we can make that change.
This commit is contained in:
@@ -154,7 +154,7 @@ cfg_fs! {
|
||||
R: Send + 'static,
|
||||
{
|
||||
let rt = context::current();
|
||||
rt.as_inner().blocking_spawner.spawn_mandatory_blocking(&rt, func)
|
||||
rt.inner.blocking_spawner().spawn_mandatory_blocking(&rt, func)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ impl Spawner {
|
||||
builder.spawn(move || {
|
||||
// Only the reference should be moved into the closure
|
||||
let _enter = crate::runtime::context::enter(rt.clone());
|
||||
rt.as_inner().blocking_spawner.inner.run(id);
|
||||
rt.inner.blocking_spawner().inner.run(id);
|
||||
drop(shutdown_tx);
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user