summaryrefslogtreecommitdiffstats
path: root/tokio/tests/rt_basic.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-06-12chore: reduce pin related unsafe code (#2613)Taiki Endo
2020-06-07chore: fix ci failure on master (#2593)Taiki Endo
* Fix clippy warnings * Pin rustc version to 1.43.1 in macOS Refs: https://github.com/rust-lang/rust/issues/73030
2020-02-12io: avoid unnecessary wake in registration (#2221)Jon Gjengset
See discussion in #2222. This wake/notify call has been there in one form or another since the very early days of tokio. Currently though, it is not clear that it is needed; the contract for polling is that you must keep polling until you get `Pending`, so doing a wakeup when we are about to return `Ready` is premature.
2020-01-08rt: fix threaded scheduler shutdown deadlock (#2074)Carl Lerche
Previously, if an IO event was received during the runtime shutdown process, it was possible to enter a deadlock. This was due to the scheduler shutdown logic not expecting tasks to get scheduled once the worker was in the shutdown process. This patch fixes the deadlock by checking the queues for new tasks after each call to park. If a new task is received, it is forcefully shutdown. Fixes #2061
2020-01-06Fix basic_scheduler deadlock when waking during drop (#2062)Sean McArthur
2019-12-20chore: formatting, docs and clippy (#2000)Artem Vorotnikov
2019-12-17rt: avoid dropping a task in calls to wake() (#1972)Carl Lerche
Calls to tasks should not be nested. Currently, while a task is being executed and the runtime is shutting down, a call to wake() can result in the wake target to be dropped. This, in turn, results in the drop handler being called. If the user holds a ref cell borrow, a mutex guard, or any such value, dropping the task inline can result in a deadlock. The fix is to permit tasks to be scheduled during the shutdown process and dropping the tasks once they are popped from the queue. Fixes #1929, #1886
2019-11-22default all feature flags to off (#1811)Carl Lerche
Changes the set of `default` feature flags to `[]`. By default, only core traits are included without specifying feature flags. This makes it easier for users to pick the components they need. For convenience, a `full` feature flag is included that includes all components. Tests are configured to require the `full` feature. Testing individual feature flags will need to be moved to a separate crate. Closes #1791
2019-11-21runtime: cleanup and add config options (#1807)Carl Lerche
* runtime: cleanup and add config options This patch finishes the cleanup as part of the transition to Tokio 0.2. A number of changes were made to take advantage of having all Tokio types in a single crate. Also, fixes using Tokio types from `spawn_blocking`. * Many threads, one resource driver Previously, in the threaded scheduler, a resource driver (mio::Poll / timer combo) was created per thread. This was more or less fine, except it required balancing across the available drivers. When using a resource driver from **outside** of the thread pool, balancing is tricky. The change was original done to avoid having a dedicated driver thread. Now, instead of creating many resource drivers, a single resource driver is used. Each scheduler thread will attempt to "lock" the resource driver before parking on it. If the resource driver is already locked, the thread uses a condition variable to park. Contention should remain low as, under load, the scheduler avoids using the drivers. * Add configuration options to enable I/O / time New configuration options are added to `runtime::Builder` to allow enabling I/O and time drivers on a runtime instance basis. This is useful when wanting to create lightweight runtime instances to execute compute only tasks. * Bug fixes The condition variable parker is updated to the same algorithm used in `std`. This is motivated by some potential deadlock cases discovered by `loom`. The basic scheduler is fixed to fairly schedule tasks. `push_front` was accidentally used instead of `push_back`. I/O, time, and spawning now work from within `spawn_blocking` closures. * Misc cleanup The threaded scheduler is no longer generic over `P :Park`. Instead, it is hard coded to a specific parker. Tests, including loom tests, are updated to use `Runtime` directly. This provides greater coverage. The `blocking` module is moved back into `runtime` as all usage is within `runtime` itself.
2019-11-16runtime: rename current_thread -> basic_scheduler (#1769)Carl Lerche
It no longer supports executing !Send futures. The use case for It is wanting a “light” runtime. There will be “local” task execution using a different strategy coming later. This patch also renames `thread_pool` -> `threaded_scheduler`, but only in public APIs for now.