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

feat: use async_executor::StaticExecutor #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tokio03 = ["tokio03-crate"]

[dependencies]
async-channel = "^2.1.1"
async-executor = "^1.8"
async-executor = { version = "^1.12", features = ["static"] }
async-lock = "^3.2"
blocking = "^1.5"
futures-lite = "^2.0"
Expand Down
6 changes: 3 additions & 3 deletions src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::Task;
use async_executor::{Executor, LocalExecutor};
use async_executor::{LocalExecutor, StaticExecutor};
use std::future::Future;

pub(crate) static GLOBAL_EXECUTOR: Executor<'_> = Executor::new();
pub(crate) static GLOBAL_EXECUTOR: StaticExecutor = StaticExecutor::new();

thread_local! {
pub(crate) static LOCAL_EXECUTOR: LocalExecutor<'static> = LocalExecutor::new();
pub(crate) static LOCAL_EXECUTOR: LocalExecutor<'static> = const { LocalExecutor::new() };
}

/// Runs the global and the local executor on the current thread
Expand Down
2 changes: 1 addition & 1 deletion src/threading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static GLOBAL_EXECUTOR_EXPECTED_THREADS_NUMBER: Mutex<usize> = Mutex::new(0);
thread_local! {
// Used to shutdown a thread when we receive a message from the Sender.
// We send an ack using to the Receiver once we're finished shutting down.
static THREAD_SHUTDOWN: OnceCell<(Sender<()>, Receiver<()>)> = OnceCell::new();
static THREAD_SHUTDOWN: OnceCell<(Sender<()>, Receiver<()>)> = const { OnceCell::new() };
}

/// Spawn more executor threads, up to configured max value.
Expand Down
Loading