It would be very cool if a Compat could be produced for consuming the Spawner in the Tokio Handler so that the non-tokio runtime can spawn Tokio tasks.
The way I'm thinking to do it is to first, have the background thread do a sleep(u64::MAX) so that it can never process any spawned tasks.
Then, we hijack the Spawner from the handler (currently impossible as spawner field along with other needed data types are pub(crate)) and process tasks from it by putting them onto the current runtime's task queue.
It would be very cool if a Compat could be produced for consuming the Spawner in the Tokio Handler so that the non-tokio runtime can spawn Tokio tasks.
The way I'm thinking to do it is to first, have the background thread do a
sleep(u64::MAX)
so that it can never process any spawned tasks.Then, we hijack the Spawner from the handler (currently impossible as spawner field along with other needed data types are
pub(crate)
) and process tasks from it by putting them onto the current runtime's task queue.