Skip to content

Commit 5a27c8b

Browse files
committed
feat: publicize get_runtime_handle()
This is useful to avoid creating multiple tokio runtimes, when one needs a way to spawn new futures and so on.
1 parent 544701c commit 5a27c8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ impl<T: futures_io::AsyncSeek> tokio::io::AsyncSeek for Compat<T> {
454454
}
455455
}
456456

457-
fn get_runtime_handle() -> tokio::runtime::Handle {
457+
/// Return a handle to the current runtime, or the fallback runtime, if any.
458+
pub fn get_runtime_handle() -> tokio::runtime::Handle {
458459
tokio::runtime::Handle::try_current().unwrap_or_else(|_| TOKIO1.handle().clone())
459460
}
460461

0 commit comments

Comments
 (0)