Skip to content

Commit

Permalink
Quickfix for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Jan 30, 2024
1 parent 76bf6a4 commit 7e241e4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions commons/zenoh-core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,27 @@ macro_rules! to_u64 {
};
}

// This macro allows to spawn the right amount of threads in the
// async_std executor
#[macro_export]
macro_rules! zasync_executor_init {
() => {
use async_global_executor;

// Zenoh requires at least 4 threads to run
const ASYNC_STD_THREAD_COUNT_MIN: usize = 4;

let count = async_global_executor::spawn_more_threads(ASYNC_STD_THREAD_COUNT_MIN)
.await
.unwrap();

log::trace!(
"Spawned {} additional threads in the async global executor",
count
);
};
}

// This macro allows to parse a string to the target type
#[macro_export]
macro_rules! zparse {
Expand Down
2 changes: 1 addition & 1 deletion plugins/zenoh-plugin-rest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
anyhow = { workspace = true, features = ["default"] }
async-std = { workspace = true, features = ["default"] }
async-std = { workspace = true, features = ["default", "attributes"] }
base64 = { workspace = true }
clap = { workspace = true }
const_format = { workspace = true }
Expand Down

0 comments on commit 7e241e4

Please sign in to comment.