diff options
author | Gardner Vickers <gardner@vickers.me> | 2019-12-24 18:34:47 -0500 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-12-24 15:34:47 -0800 |
commit | 67bf9c36f347031ca05872d102a7f9abc8b465f0 (patch) | |
tree | 22c0f472b594382a1bb6fa186b7f40fe4c17013d /tokio/src/task | |
parent | 101f770af33ae65820e1cc0e9b89d998b3c1317a (diff) |
rt: coalesce thread-locals used by the runtime (#1925)
Previously, thread-locals used by the various drivers were situated
with the driver code. This resulted in state being spread out and many
thread-locals being required to run a runtime.
This PR coalesces the thread-locals into a single struct.
Diffstat (limited to 'tokio/src/task')
-rw-r--r-- | tokio/src/task/spawn.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index 4d18ee23..c4589308 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -123,6 +123,8 @@ doc_rt_core! { T: Future + Send + 'static, T::Output: Send + 'static, { - runtime::spawn(task) + let spawn_handle = runtime::context::ThreadContext::spawn_handle() + .expect("must be called from the context of Tokio runtime configured with either `basic_scheduler` or `threaded_scheduler`"); + spawn_handle.spawn(task) } } |