summaryrefslogtreecommitdiffstats
path: root/tokio/tests/task_blocking.rs
AgeCommit message (Collapse)Author
2020-10-12rt: Remove `threaded_scheduler()` and `basic_scheduler()` (#2876)Lucio Franco
Co-authored-by: Alice Ryhl <alice@ryhl.io> Co-authored-by: Carl Lerche <me@carllerche.com>
2020-08-27rt: Refactor `Runtime::block_on` to take `&self` (#2782)Lucio Franco
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-07-28Reset coop budget when blocking in block_on (#2711)Jon Gjengset
Previously, we would fail to reset the coop budget in this case, making it so that `coop::poll_proceed` would perpetually yield `Poll::Pending` in nested executers even when run in `block_in_place`. This is also a further improvement on #2645.
2020-07-21provide a way to drop a runtime in an async context (#2646)bdonlan
Dropping a runtime normally involves waiting for any outstanding blocking tasks to complete. When this drop happens in an asynchronous context, we previously would issue a cryptic panic due to trying to block in an asynchronous context. This change improves the panic message, and adds a `shutdown_blocking()` function which can be used to shutdown a runtime without blocking at all, as an out for cases where this really is necessary. Co-authored-by: Bryan Donlan <bdonlan@amazon.com> Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-07-14rt: allow block_on inside block_in_place inside block_on (#2645)bdonlan
A fast path in block_on_place was failing to call exit() in the case where we were in a block_on call. Fixes: #2639 Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-04-20Be more principled about when blocking is ok (#2410)Jon Gjengset
This enables `block_in_place` to be used in more contexts. Specifically, it allows you to block whenever you are off the tokio runtime (like if you are not using tokio, are in a `spawn_blocking` closure, etc.), and in the threaded scheduler's `block_on`. Blocking in `LocalSet` and the basic scheduler's` block_on` is still disallowed. Fixes #2327. Fixes #2393.
2020-04-16Support nested block_in_place (#2409)Jon Gjengset
2019-11-29rt: fix `basic_scheduler` notification bug (#1861)Carl Lerche
The "global executor" thread-local is to track where to spawn new tasks, **not** which scheduler is active on the current thread. This fixes a bug with scheduling tasks on the basic_scheduler by tracking the currently active basic_scheduler with a dedicated thread-local variable. Fixes: #1851