smol-rs / async-compat

Compatibility adapter between tokio and futures
Apache License 2.0
156 stars 12 forks source link

Only create/enter new runtime if one does not already exist? #29

Closed bonsairobo closed 5 months ago

bonsairobo commented 8 months ago

From my reading of the code, Compat futures will unconditionally create and enter a new single-threaded tokio runtime. This seems potentially inefficient if a tokio runtime (maybe a multi-threaded one) already exists.

Would it be possible to check if a runtime already exists before entering a new one?

bonsairobo commented 8 months ago

BTW, #30 might be a solution for #2 as well, depending on the exact use case.