diff --git a/actix-rt/examples/hyper.rs b/actix-rt/examples/hyper.rs
index 52e0da30..15074729 100644
--- a/actix-rt/examples/hyper.rs
+++ b/actix-rt/examples/hyper.rs
@@ -11,11 +11,18 @@ async fn handle(_req: Request
) -> Result, Infallible> {
fn main() {
actix_rt::System::with_tokio_rt(|| {
- tokio::runtime::Builder::new_multi_thread()
- .enable_all()
- .build()
- .unwrap()
- // for io_uring feature use `tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()`
+ // this cfg is needed when use it with io-uring, if you don't use io-uring
+ // you can remove this cfg and last line in this closure
+ #[cfg(not(feature = "io-uring"))]
+ {
+ tokio::runtime::Builder::new_multi_thread()
+ .enable_all()
+ .build()
+ .unwrap()
+ }
+ // you can remove this two lines if you don't have tokio_uring feature enabled
+ #[cfg(feature = "io-uring")]
+ tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()
})
.block_on(async {
let make_service =
diff --git a/actix-rt/examples/multi_thread_system.rs b/actix-rt/examples/multi_thread_system.rs
index 0ecd1ef1..4d03cd2d 100644
--- a/actix-rt/examples/multi_thread_system.rs
+++ b/actix-rt/examples/multi_thread_system.rs
@@ -5,12 +5,22 @@ use actix_rt::System;
fn main() {
System::with_tokio_rt(|| {
- // build system with a multi-thread tokio runtime.
- tokio::runtime::Builder::new_multi_thread()
- .worker_threads(2)
- .enable_all()
- .build()
- .unwrap()
+ // this cfg is needed when use it with io-uring, if you don't use io-uring
+ // you can remove this cfg and last line in this closure
+ #[cfg(not(feature = "io-uring"))]
+ {
+ // build system with a multi-thread tokio runtime.
+ tokio::runtime::Builder::new_multi_thread()
+ .worker_threads(2)
+ .enable_all()
+ .build()
+ .unwrap()
+ }
+ // you can remove this two lines if you don't have tokio_uring feature enabled.
+ // Note: tokio_uring is single thread and can't be multithreaded,
+ // unless you spawn multiple of them
+ #[cfg(feature = "io-uring")]
+ tokio_uring::Runtime::new(&tokio_uring::builder()).unwrap()
})
.block_on(async_main());
}