Skip to content

Commit 0e498d5

Browse files
authored
RUST-1965 Use the implicit runtime when spawning tasks via the sync API (#1121)
1 parent f6ca3bf commit 0e498d5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ buildvariants:
197197

198198
- name: sync-api
199199
display_name: "Sync API"
200-
patchable: false
201200
run_on:
202201
- rhel87-small
203202
expansions:

src/runtime/join_handle.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ impl<T> AsyncJoinHandle<T> {
1414
F: Future<Output = T> + Send + 'static,
1515
T: Send + 'static,
1616
{
17+
#[cfg(not(feature = "sync"))]
1718
let handle = tokio::runtime::Handle::current();
19+
#[cfg(feature = "sync")]
20+
let handle = tokio::runtime::Handle::try_current()
21+
.unwrap_or_else(|_| crate::sync::TOKIO_RUNTIME.handle().clone());
1822
AsyncJoinHandle(handle.spawn(fut))
1923
}
2024
}

0 commit comments

Comments
 (0)