Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindings: double down on Wakers #4807

Open
camshaft opened this issue Sep 27, 2024 · 1 comment
Open

bindings: double down on Wakers #4807

camshaft opened this issue Sep 27, 2024 · 1 comment

Comments

@camshaft
Copy link
Contributor

Problem:

None of our poll_* functions actually take a cx: &mut std::task::Context, which is the standardized interface for futures in Rust. Instead, applications are expected to call conn.set_waker(cx.waker()) before calling poll_*.

Solution:

We should, instead, double down on async, and require std::task::Context to be passed to all functions that have the signature fn poll_*(&mut self, cx: &mut std::task::Context) -> Poll<Result<_>>;. For blocking IO applications, it's very trivial to make no-op wakers, especially with the coming Waker::noop method in std (see rust-lang/rust#98286). We can also add blocking APIs that construct noop wakers, if this is too painful as well.

@maddeleine
Copy link
Contributor

We would like this this before moving to 1.0.

@maddeleine maddeleine added the priority/low Rank 4 label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants