Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Use MainContext::with_thread_default() instead of pushing/popping man… #529

Merged
merged 1 commit into from Oct 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/main_context_futures.rs
Expand Up @@ -214,9 +214,7 @@ impl TaskSource {

// Clone that we store in the task local data so that
// it can be retrieved as needed
executor.push_thread_default();

let res = {
let res = executor.with_thread_default(|| {
let enter = futures::executor::enter().unwrap();
let mut context = Context::from_waker(&waker);

Expand All @@ -225,9 +223,8 @@ impl TaskSource {
drop(enter);

res
};
});

executor.pop_thread_default();
res
} else {
Poll::Ready(())
Expand Down