aboutsummaryrefslogtreecommitdiff
path: root/p2p/examples/shared
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-04-11 10:19:20 +0200
committerhozan23 <hozan23@karyontech.net>2024-05-19 13:51:30 +0200
commit0992071a7f1a36424bcfaf1fbc84541ea041df1a (patch)
tree961d73218af672797d49f899289bef295bc56493 /p2p/examples/shared
parenta69917ecd8272a4946cfd12c75bf8f8c075b0e50 (diff)
add support for tokio & improve net crate api
Diffstat (limited to 'p2p/examples/shared')
-rw-r--r--p2p/examples/shared/mod.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/p2p/examples/shared/mod.rs b/p2p/examples/shared/mod.rs
index 8065e63..57d89ef 100644
--- a/p2p/examples/shared/mod.rs
+++ b/p2p/examples/shared/mod.rs
@@ -1,9 +1,7 @@
-use std::{num::NonZeroUsize, thread};
+use std::{num::NonZeroUsize, sync::Arc, thread};
use easy_parallel::Parallel;
-use smol::{channel, future, future::Future};
-
-use karyon_core::async_util::Executor;
+use smol::{channel, future, future::Future, Executor};
/// Returns an estimate of the default amount of parallelism a program should use.
/// see `std::thread::available_parallelism`
@@ -14,7 +12,7 @@ fn available_parallelism() -> usize {
}
/// Run a multi-threaded executor
-pub fn run_executor<T>(main_future: impl Future<Output = T>, ex: Executor<'_>) {
+pub fn run_executor<T>(main_future: impl Future<Output = T>, ex: Arc<Executor<'_>>) {
let (signal, shutdown) = channel::unbounded::<()>();
let num_threads = available_parallelism();