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:
Carl Lerche
2022-09-16 14:05:09 -07:00
committed by GitHub
parent b5709baa91
commit ebeb78ed40
16 changed files with 654 additions and 607 deletions
+2 -2
View File
@@ -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);
})
}