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

add task::LocalSet API for running !Send futures #1733

Merged
merged 76 commits into from Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7eee2ec
first pass on local task set
hawkw Nov 4, 2019
366ecbd
it works!
hawkw Nov 4, 2019
82857dd
change API to work with multiple block ons
hawkw Nov 5, 2019
edd8ca4
shutdown on drop
hawkw Nov 5, 2019
2e6cf55
use marker types to indicate whether a task is Send
hawkw Nov 5, 2019
c1e4e4a
add docs
hawkw Nov 5, 2019
968eea5
re-export local mod from root, feature flag
hawkw Nov 5, 2019
983b6b7
placate clippy
hawkw Nov 5, 2019
fb99e68
fix doctest
hawkw Nov 5, 2019
d6ff66e
*actually* fix doctest
hawkw Nov 5, 2019
bc93168
fix wrong assertions
hawkw Nov 5, 2019
17c7f7e
fix missing pin-project without default features
hawkw Nov 5, 2019
78d41b8
fix unused code when `local` is disabled
hawkw Nov 5, 2019
057f415
add send markers to debug output
hawkw Nov 5, 2019
f00f099
fdsgkhsdfhjkgljkfdg;jklagdsf
hawkw Nov 5, 2019
157e2e2
fix more feature-flaggy sadness
hawkw Nov 5, 2019
2a88b5f
rename marker types
hawkw Nov 6, 2019
eef8727
make markers void structs
hawkw Nov 6, 2019
1c0cea1
remove duplicate file
hawkw Nov 6, 2019
b6243c6
fix wrong assertions
hawkw Nov 6, 2019
44fb6c8
add test that timer exists
hawkw Nov 6, 2019
ff05221
document and test interaction with blocking
hawkw Nov 6, 2019
45dc55a
fix wrong doctest
hawkw Nov 6, 2019
b92ff94
fix missing feature flag
hawkw Nov 6, 2019
e09fb8e
agh, doctest
hawkw Nov 6, 2019
fec3b91
don't run local tests when running loom tests
hawkw Nov 6, 2019
478e73f
rename TaskSet -> TaskGroup
hawkw Nov 7, 2019
da87e96
rename `spawn_local` to `local::spawn`
hawkw Nov 7, 2019
267f3f3
improve API docs
hawkw Nov 7, 2019
c06cba8
Merge branch 'master' into eliza/local-spawn
hawkw Nov 7, 2019
99e05b2
track `timer` being renamed to `time` (#1745)
hawkw Nov 7, 2019
44ad494
Merge branch 'master' into eliza/local-spawn
hawkw Nov 13, 2019
1b9b25c
move local out of runtime and into task
hawkw Nov 13, 2019
b8488c7
rename to `spawn_local`
hawkw Nov 13, 2019
07317af
rename `TaskGroup` -> `LocalSet`
hawkw Nov 13, 2019
6f7607e
remove root reexport
hawkw Nov 13, 2019
2246de2
remove from runtime
hawkw Nov 13, 2019
c4f6034
doctest fixup
hawkw Nov 13, 2019
f4d8b5a
simplify Send marker
hawkw Nov 13, 2019
8f21118
fix tests using the wrong blocking
hawkw Nov 13, 2019
cbc1a42
naming + internal docs improvement
hawkw Nov 13, 2019
72472ca
set thread local in block_on
hawkw Nov 13, 2019
927ae9b
fix local future spinning instead of parking
hawkw Nov 13, 2019
34e3428
local scheduler doesn't need to be Send + Sync
hawkw Nov 13, 2019
0fbe6ab
add tests for waking a local set from IO
hawkw Nov 13, 2019
1ad14c7
use the rt's waker in block_on
hawkw Nov 13, 2019
ab19812
rm phantomdata
hawkw Nov 13, 2019
1007cad
fix local queue being pushed to from remote
hawkw Nov 13, 2019
5265b41
remove "local" feature
hawkw Nov 13, 2019
c42992b
add additional assertions
hawkw Nov 13, 2019
0514a56
use AtomicWaker instead of mutex
hawkw Nov 13, 2019
c7b0cb7
avoid double panics
hawkw Nov 13, 2019
36efbb4
fix warnings
hawkw Nov 13, 2019
25d9bf4
rustfmt
hawkw Nov 13, 2019
26994c9
placate clippy
hawkw Nov 13, 2019
20ccb39
maybe they were supposed to be underscores???
hawkw Nov 13, 2019
f28ded7
undo unrelated naming change
hawkw Nov 13, 2019
ef29af8
review feedback
hawkw Nov 14, 2019
7a9c84e
put clippy attribute in the right place
hawkw Nov 14, 2019
f1211e3
fix unused code based on feature flags
hawkw Nov 14, 2019
6ff8c4f
review feedback: rename `ScheduleSend` -> `ScheduleSendOnly`
hawkw Nov 14, 2019
b21cca7
Merge master + update some things
hawkw Nov 18, 2019
17d520a
Avoid starving the remote queue
hawkw Nov 18, 2019
cfa2808
allow tasks to be cancelled remotely
hawkw Nov 18, 2019
6f43e7e
update tests to use schedulers that actually do stuff
hawkw Nov 18, 2019
f1c82c5
fix accidental hang in test
hawkw Nov 18, 2019
b919c95
add test for sending a local future's JoinHandle
hawkw Nov 18, 2019
fe93b45
fix yielding
hawkw Nov 21, 2019
66f4a45
Merge branch 'master' into eliza/local-spawn
hawkw Nov 26, 2019
40374f7
fix bad merge
hawkw Nov 26, 2019
7260998
fix bad merge 2: the fixening
hawkw Nov 26, 2019
e40faca
more cleanup
hawkw Nov 26, 2019
9c805b6
rm empty file committed accidentally
hawkw Nov 26, 2019
04b0189
move to rt-util feature
hawkw Nov 26, 2019
0528537
panic if nested
hawkw Nov 26, 2019
3418bfb
fix AtomicWaker being enabled when not used
hawkw Nov 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions tokio/Cargo.toml
Expand Up @@ -39,6 +39,7 @@ full = [
"net",
"process",
"rt-core",
"rt-util",
"rt-threaded",
"signal",
"stream",
Expand Down Expand Up @@ -67,6 +68,7 @@ process = [
]
# Includes basic task execution capabilities
rt-core = []
rt-util = []
rt-threaded = [
"num_cpus",
"rt-core",
Expand Down
21 changes: 21 additions & 0 deletions tokio/src/macros/cfg.rs
Expand Up @@ -52,6 +52,17 @@ macro_rules! cfg_not_blocking_impl {
}
}

/// Enable internal `AtomicWaker` impl
macro_rules! cfg_atomic_waker_impl {
($($item:item)*) => {
$(
#[cfg(any(feature = "io-driver", feature = "time", feature = "rt-util"))]
#[cfg(not(loom))]
$item
)*
}
}

macro_rules! cfg_dns {
($($item:item)*) => {
$(
Expand Down Expand Up @@ -220,6 +231,16 @@ macro_rules! cfg_rt_threaded {
}
}

macro_rules! cfg_rt_util {
($($item:item)*) => {
$(
#[cfg(feature = "rt-util")]
#[cfg_attr(docsrs, doc(cfg(feature = "rt-util")))]
$item
)*
}
}

macro_rules! cfg_not_rt_threaded {
($($item:item)*) => {
$( #[cfg(not(feature = "rt-threaded"))] $item )*
Expand Down
4 changes: 3 additions & 1 deletion tokio/src/runtime/basic_scheduler.rs
@@ -1,5 +1,5 @@
use crate::park::{Park, Unpark};
use crate::task::{self, JoinHandle, Schedule, Task};
use crate::task::{self, JoinHandle, Schedule, ScheduleSendOnly, Task};

use std::cell::UnsafeCell;
use std::collections::VecDeque;
Expand Down Expand Up @@ -304,6 +304,8 @@ impl Schedule for SchedulerPriv {
}
}

impl ScheduleSendOnly for SchedulerPriv {}

impl<P> Drop for BasicScheduler<P>
where
P: Park,
Expand Down
4 changes: 3 additions & 1 deletion tokio/src/runtime/blocking/schedule.rs
@@ -1,4 +1,4 @@
use crate::task::{Schedule, Task};
use crate::task::{Schedule, ScheduleSendOnly, Task};

/// `task::Schedule` implementation that does nothing. This is unique to the
/// blocking scheduler as tasks scheduled are not really futures but blocking
Expand All @@ -16,3 +16,5 @@ impl Schedule for NoopSchedule {
unreachable!();
}
}

impl ScheduleSendOnly for NoopSchedule {}
6 changes: 4 additions & 2 deletions tokio/src/runtime/thread_pool/shared.rs
@@ -1,7 +1,7 @@
use crate::park::Unpark;
use crate::runtime::Unparker;
use crate::runtime::thread_pool::slice;
use crate::task::{self, Schedule, Task};
use crate::runtime::Unparker;
use crate::task::{self, Schedule, ScheduleSendOnly, Task};

use std::ptr;

Expand Down Expand Up @@ -90,3 +90,5 @@ impl Schedule for Shared {
Self::schedule(self, task);
}
}

impl ScheduleSendOnly for Shared {}
2 changes: 1 addition & 1 deletion tokio/src/sync/mod.rs
Expand Up @@ -35,7 +35,7 @@ cfg_sync! {
}

cfg_not_sync! {
cfg_resource_drivers! {
cfg_atomic_waker_impl! {
mod task;
pub(crate) use task::AtomicWaker;
}
Expand Down