summaryrefslogtreecommitdiffstats
path: root/tokio-macros/src/lib.rs
AgeCommit message (Collapse)Author
2020-12-09chore: prepare for Tokio 1.0 work (#3238)Carl Lerche
2020-11-30macros: #[tokio::main] can be used on non-main (#3199)Ivan Tham
2020-11-26macros: fix outdated documentation (#3180)Rajiv Chauhan
1. Changed 0.2 to 0.3 2. Changed ‘multi’ to ‘single’ to indicate that the behavior is single threaded
2020-10-26macros: prepare tokio-macros 0.3.1 (#3042)Alice Ryhl
2020-10-24docs: remove `max_threads` mentions in tokio-macros (#3038)nickelc
2020-10-12rt: simplify rt-* features (#2949)Taiki Endo
tokio: merge rt-core and rt-util as rt rename rt-threaded to rt-multi-thread tokio-util: rename rt-core to rt Closes #2942
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-09-05runtime: improve runtime vs #[tokio::main] doc (#2820)Igor Aleksanov
2020-08-27Docs delay queue (#2793)Blas Rodriguez Irizar
2020-08-07chore: prepare for v0.3 breaking changes (#2747)Carl Lerche
Bug fixes will be applied to the v0.2.x branch.
2020-07-26macros: document basic_scheduler option (#2697)Alice Ryhl
2020-07-24rt: document how #[tokio::main] is expanded (#2683)xd009642
2020-05-20tokio-macros: warn about renaming the tokio dependency (#2521)Geoff Shannon
2020-02-27chore: prepare v0.2.12 release (#2278)Carl Lerche
Also includes `tokio-macros` v0.2.5.
2020-02-26docs: macros doc(cfg) workarounds (#2225)David Kellum
This is a workaround for the fact that the doc(cfg) from outer cfg_* macros doesn't get applied correctly. Its included in the rt-threaded branch only, which is what is used for doc.rs via all-features.
2020-02-11Fix doc comment spelling in lib.rs (#2233)lord
2020-01-26chore: bump nightly version used in CI (#2178)Carl Lerche
This requires fixing a few warnings.
2020-01-22Provide `select!` macro (#2152)Carl Lerche
Provides a `select!` macro for concurrently waiting on multiple async expressions. The macro has similar goals and syntax as the one provided by the `futures` crate, but differs significantly in implementation. First, this implementation does not require special traits to be implemented on futures or streams (i.e., no `FuseFuture`). A design goal is to be able to pass a "plain" async fn result into the select! macro. Even without `FuseFuture`, this `select!` implementation is able to handle all cases the `futures::select!` macro can handle. It does this by supporting pre-poll conditions on branches and result pattern matching. For pre-conditions, each branch is able to include a condition that disables the branch if it evaluates to false. This allows the user to guard futures that have already been polled, preventing double polling. Pattern matching can be used to disable streams that complete. A second big difference is the macro is implemented almost entirely as a declarative macro. The biggest advantage to using this strategy is that the user will not need to alter the rustc recursion limit except in the most extreme cases. The resulting future also tends to be smaller in many cases.
2020-01-21macros: fix `#[tokio::main]` without rt-core (#2139)Carl Lerche
The Tokio runtime provides a "shell" runtime when `rt-core` is not available. This shell runtime is enough to support `#[tokio::main`] and `#[tokio::test]. A previous change disabled these two attr macros when `rt-core` was not selected. This patch fixes this by re-enabling the `main` and `test` attr macros without `rt-core` and adds some integration tests to prevent future regressions.
2020-01-07macros: fix breaking changes (#2069)Carl Lerche
Brings back old macro implementations and updates the version of tokio-macros that tokio depends on. Prepares a new release.
2020-01-07chore: prepare tokio-macros v0.2.2 release (#2068)Artem Vorotnikov
2020-01-02macros: do not automatically pull rt-core (#2038)Artem Vorotnikov
2019-12-27Refactor proc macros, add more knobs (#2022)Artem Vorotnikov
* Refactor proc macros, add more knobs * make macros work with rt-core
2019-12-20chore: formatting, docs and clippy (#2000)Artem Vorotnikov
2019-12-18chore: prepare v0.2.5 release (#1984)Carl Lerche
Also includes: - `tokio-macros` v0.2.1
2019-12-13macros: inherit visibilityDouman
2019-11-26chore: prepare v0.2.0 release (#1822)Carl Lerche
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.
2019-11-01runtime: merge multi & single threaded runtimes (#1716)Carl Lerche
Simplify Tokio's runtime construct by combining both Runtime variants into a single type. The execution style can be controlled by a configuration setting on `Builder`. The implication of this change is that there is no longer any way to spawn `!Send` futures. This, however, is a temporary limitation. A different strategy will be employed for supporting `!Send` futures. Included in this patch is a rework of `task::JoinHandle` to support using this type from both the thread-pool and current-thread executors.
2019-10-12macros: Use more consistent runtime names (#1628)Jon Gjengset
As discussed in #1620, the attribute names for `#[tokio::main]` and `#[tokio::test]` aren't great. Specifically, they both use `single_thread` and `multi_thread`, as opposed to names that match the runtime names: `current_thread` and `threadpool`. This PR changes the former to the latter. Fixes #1627.
2019-10-02macros: allow selecting runtime in tokio::test attr (#1620)Jon Gjengset
In the past, it was not possible to choose to use the multi-threaded tokio `Runtime` in tests, which meant that any test that transitively used `executor::threadpool::blocking` would fail with ``` 'blocking' annotation used from outside the context of a thread pool ``` This patch adds a runtime annotation attribute to `#[tokio::test]` just like `#[tokio::main]` has, which lets users opt in to the threadpool runtime over `current_thread` (the default).
2019-10-01macros: Allow arguments in non-main functionsDouman
2019-09-30Prepare for release of 0.2.0-alpha.6 (#1617)Jon Gjengset
Note that `tokio-timer` and `tokio-tls` become 0.3.0-alpha.6 (not 0.2.0)
2019-09-24tokio: add `rt-current-thread` optional featureSean McArthur
- Adds a minimum `rt-current-thread` optional feature that exports `tokio::runtime::current_thread`. - Adds a `macros` optional feature to enable the `#[tokio::main]` and `#[tokio::test]` attributes. - Adjusts `#[tokio::main]` macro to select a runtime "automatically" if a specific strategy isn't specified. Allows using the macro with only the rt-current-thread feature.
2019-09-23macros: add build tests for #[tokio::main] and #[tokio::test] (#1591)Taiki Endo
2019-09-23macros: fix handling of arguments of #[tokio::main] attribute (#1578)Taiki Endo
2019-09-19Release 0.2.0 alpha.5 (#1576)Carl Lerche
2019-09-19chore: deny warnings for doc tests (#1539)Taiki Endo
2019-09-13chore: fix docs links (#1523)Geoff Shannon
2019-08-29prepare v0.2.0-alpha.4 (#1509)Sean McArthur
2019-08-28prepare v0.2.0-alpha.3 release (#1505)Carl Lerche
2019-08-20chore: bump to newer nightly (#1485)Taiki Endo
2019-08-17chore: prepare 0.2.0-alpha.2 release (#1465)Carl Lerche
2019-08-13macros: upgrade syn/quote (#1432)Douman
2019-08-11chore: apply unreachable_pub and missing_debug_implementations to all crates ↵Taiki Endo
(#1424)
2019-08-09macros: improve error messages (#1420)Taiki Endo
2019-08-10chore: change default lint level to warning and deny warnings in CI (#1416)Taiki Endo
2019-08-09macros: Error on function with arguments (#1419)Douman
2019-08-08chore: prepare for v0.2.0-alpha.1 release (#1410)Lucio Franco