An async executor.
It is part of safina
, a safe async runtime.
FnOnce
to run on a separate thread pool
for blocking jobs.forbid(unsafe_code)
std
https://docs.rs/safina-executor
rust
let executor = safina_executor::Executor::default();
let (sender, receiver) = std::sync::mpsc::channel();
executor.spawn(async move {
sender.send(()).unwrap();
});
receiver.recv().unwrap();
rust
let result = safina_executor::block_on(async {
prepare_request().await?;
execute_request().await
})?;
rust
let result = safina_executor::schedule_blocking(|| {
read_file1()?;
read_file2()
}).await.unwrap()?;
async-executor
unsafe
codefutures-executor
unsafe
tokio-executor
unsafe
executors
unsafe
codebastion-executor
unsafe
coderayon_core
unsafe
codepollster
unsafe
codelelet
unsafe
codefibers
nostd_async
unsafe
codeembedded-executor
unsafe
codespin_on
pasts
switchyard
unsafe
codesealrs
rusty_pool
schedule_blocking
to return new safina_sync::Receiver
.Executor::new
and Executor::with_name
to return Result
.safina-threadpool
v0.2.0.block_on
functions to take futures that are not Send
.block_on
and block_on_unpin
when task is awakened a second time.schedule_blocking
and
Executor::schedule_blocking
OnceCell
.safina_threadpool
internally.spawn
and block_on
without
using Box::pin
.
Add spawn_unpin
and block_on_unpin
for folks who need to avoid allocating.
so callers don't have to.safina
#[async_main]
macroflume
to eliminate the receiver mutex and reduce contention.Cargo.toml
and bump version number../release.sh
License: Apache-2.0