Merge branch 'fix-0.3.4' into 'main'

Fix 0.3.4

See merge request veilid/veilid!304
This commit is contained in:
Christien Rioux 2024-08-02 02:11:32 +00:00
commit 2120278f40

View File

@ -54,8 +54,11 @@ cfg_if! {
cfg_if! {
if #[cfg(feature="rt-async-std")] {
MustJoinHandle::new(async_std::task::Builder::new().name(name.to_string()).spawn(future).unwrap())
} else if #[cfg(feature="rt-tokio")] {
} else if #[cfg(all(feature="rt-tokio", feature="tracing"))] {
MustJoinHandle::new(tokio::task::Builder::new().name(name).spawn(future).unwrap())
} else if #[cfg(feature="rt-tokio")] {
let _name = name;
MustJoinHandle::new(tokio::task::spawn(future))
}
}
}
@ -67,8 +70,11 @@ cfg_if! {
cfg_if! {
if #[cfg(feature="rt-async-std")] {
MustJoinHandle::new(async_std::task::Builder::new().name(name.to_string()).local(future).unwrap())
} else if #[cfg(feature="rt-tokio")] {
} else if #[cfg(all(feature="rt-tokio", feature="tracing"))] {
MustJoinHandle::new(tokio::task::Builder::new().name(name).spawn_local(future).unwrap())
} else if #[cfg(feature="rt-tokio")] {
let _name = name;
MustJoinHandle::new(tokio::task::spawn_local(future))
}
}
}
@ -80,8 +86,11 @@ cfg_if! {
cfg_if! {
if #[cfg(feature="rt-async-std")] {
drop(async_std::task::Builder::new().name(name.to_string()).spawn(future).unwrap());
} else if #[cfg(feature="rt-tokio")] {
} else if #[cfg(all(feature="rt-tokio", feature="tracing"))] {
drop(tokio::task::Builder::new().name(name).spawn(future).unwrap());
} else if #[cfg(feature="rt-tokio")] {
let _name = name;
drop(tokio::task::spawn(future))
}
}
}
@ -93,8 +102,11 @@ cfg_if! {
cfg_if! {
if #[cfg(feature="rt-async-std")] {
drop(async_std::task::Builder::new().name(name.to_string()).local(future).unwrap());
} else if #[cfg(feature="rt-tokio")] {
} else if #[cfg(all(feature="rt-tokio", feature="tracing"))] {
drop(tokio::task::Builder::new().name(name).spawn_local(future).unwrap());
} else if #[cfg(feature="rt-tokio")] {
let _name = name;
drop(tokio::task::spawn_local(future))
}
}
}
@ -111,8 +123,11 @@ cfg_if! {
let _name = name;
// async_std::task::Builder blocking doesn't work like spawn_blocking()
async_std::task::spawn_blocking(blocking_task).await
} else if #[cfg(feature="rt-tokio")] {
} else if #[cfg(all(feature="rt-tokio", feature="tracing"))] {
tokio::task::Builder::new().name(name).spawn_blocking(blocking_task).unwrap().await.unwrap_or(err_result)
} else if #[cfg(feature="rt-tokio")] {
let _name = name;
tokio::task::spawn_blocking(blocking_task).await.unwrap_or(err_result)
} else {
#[compile_error("must use an executor")]
}