mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
rt: add missing Send bound (#3089)
This commit is contained in:
parent
ae4e8d7ad1
commit
20a2b9e263
@ -98,7 +98,7 @@ bytes = { version = "0.6.0", optional = true }
|
||||
futures-core = { version = "0.3.0", optional = true }
|
||||
lazy_static = { version = "1.0.2", optional = true }
|
||||
memchr = { version = "2.2", optional = true }
|
||||
mio = { version = "0.7.3", optional = true }
|
||||
mio = { version = "0.7.5", optional = true }
|
||||
num_cpus = { version = "1.8.0", optional = true }
|
||||
parking_lot = { version = "0.11.0", optional = true } # Not in full
|
||||
slab = { version = "0.4.1", optional = true }
|
||||
@ -134,4 +134,4 @@ all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.playground]
|
||||
features = ["full"]
|
||||
features = ["full"]
|
||||
|
@ -70,6 +70,7 @@ const KEEP_ALIVE: Duration = Duration::from_secs(10);
|
||||
pub(crate) fn spawn_blocking<F, R>(func: F) -> JoinHandle<R>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
let rt = context::current().expect("not currently running on the Tokio runtime.");
|
||||
rt.spawn_blocking(func)
|
||||
@ -79,6 +80,7 @@ where
|
||||
pub(crate) fn try_spawn_blocking<F, R>(func: F) -> Result<(), ()>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
let rt = context::current().expect("not currently running on the Tokio runtime.");
|
||||
|
||||
|
@ -19,7 +19,8 @@ impl<T> Unpin for BlockingTask<T> {}
|
||||
|
||||
impl<T, R> Future for BlockingTask<T>
|
||||
where
|
||||
T: FnOnce() -> R,
|
||||
T: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
type Output = R;
|
||||
|
||||
|
@ -45,6 +45,7 @@ impl Handle {
|
||||
pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
#[cfg(feature = "tracing")]
|
||||
let func = {
|
||||
|
@ -392,6 +392,7 @@ cfg_rt! {
|
||||
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
|
||||
where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
self.handle.spawn_blocking(func)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user