-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add blocking wrapper #16
Comments
I feel that associating this library with specific reactors or executors such as async-io or pollster is not preferable. |
I agree that we probably shouldn't add this to trait FutureExt: Future {
/// Wait for the `Future` to complete execution.
pub fn wait(self) -> <Self as Future>::Output;
} C# has a few other overloads for my_async_function()
.timeout(Duration::from_secs(3))
.wait()?; Footnotes
|
@yoshuawuyts I believe the reason it was removed was because it was associated with the executor (I don't know the exact reason as I was not involved in Also, note that blocking with different executors can also cause deadlocks, even if you were in the right context (e.g., tokio-rs/tokio#4514 -- for this case, it is also related to cooperative scheduling of |
@taiki-e thanks for the reply! - Those are all great points, thanks for raising them. It seems I have some reading to do before proceeding. Regarding the removal of |
Aaron summarized the rationale for removing the
My main interest in the However there are clearly a lot of issues with a I think we could achieve a similar effect as a Anyway, to conclude: understanding more of the requirements of |
Thanks @yoshuawuyts and @taiki-e for your input on this. While I think it'd be great to have this in some shape, I no longer have a use case for it myself so I won't be working on this. just FYI. :) |
Suggesting we add a
blocking::Task
, a thin blocking wrapper ofTask
that's more convenient to use in the blocking code. API:For the implementation, we will either want to depend on
pollster
for itsblock_on
orasync-io
, which IMO would be a bit of an overkill so if we go forasync-io
, we probably want to feature gate this.The text was updated successfully, but these errors were encountered: