mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-31 00:00:07 +02:00
Allow access to CurrentThread executor handle (#1809)
## Motivation The `CurrentThread` runtime's `Handle` is different than the `CurrentThread` executor's `Handle`. This causes interoperability issues with custom runtimes that build on the `CurrentThread` executor. Actix-rt offers a concrete example of the issue: [`System::run_in_executor`][1] requires a `CurrentThread` executor handle - the change in this PR allows a `CurrentThread` runtime to be used here. ## Solution This PR adds `fn into_inner(self)` on the runtime `Handle` that consumes it and returns the underlying `CurrentThread` executor's `Handle`. [1]: https://docs.rs/actix-rt/0.2.6/actix_rt/struct.System.html#method.run_in_executor
This commit is contained in:
committed by
Eliza Weisman
parent
b0a90d88cd
commit
96b014c12a
@@ -55,6 +55,11 @@ impl Handle {
|
||||
pub fn status(&self) -> Result<(), tokio_executor::SpawnError> {
|
||||
self.0.status()
|
||||
}
|
||||
|
||||
/// Retrieve inner `CurrentThread` executor handle
|
||||
pub fn into_inner(self) -> ExecutorHandle {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> future::Executor<T> for Handle
|
||||
|
||||
Reference in New Issue
Block a user