Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
bors and arcnmx Merge #24
24: Panic-free async poll r=Nemo157 a=arcnmx

The `Invalid` variant that's currently used as an interim future state while starting the generator adds some overhead to `Future::poll()` and can also cause it to contain (dead) panics. Removing the variant and using slightly delayed initialization makes things better as long as we can guarantee the uninitialized state will never be externally observed. This can only happen if the `C` closure panics, which we can assume will never happen because:
1. The closure should be a trivial wrapper that only moves the context ref into the generator and returns it without doing any real work or dereferencing anything. This can simply be part of the unsafe contract upheld by callers of the `make_future()` function.
2. The only consumer of `make_future()` is the `embrio_async` macro, so we can confirm and ensure it follows this rule.
3. Targets that can't unwind and just abort on panic don't even need to worry about any of this possibly happening anyway.

This addresses the first concern of #23 in a more succinct and direct changeset.

Co-authored-by: arcnmx <>
Latest commit 2eca016 Sep 21, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
embrio-async Initialise future generator context pointers later Sep 16, 2019
embrio-native Update to futures alpha.18 and new nightly Aug 10, 2019
embrio export embrio::io::BufRead Sep 15, 2019
.gitignore Initial commit Mar 26, 2018
Cargo.toml Rewrite async/await in their entirety. May 12, 2019
LICENSE-MIT Add licenses Aug 6, 2018

You can’t perform that action at this time.