mirror of https://github.com/fafhrd91/actix-net
use tokio-uring release version
This commit is contained in:
parent
3dafa01453
commit
fc3664b623
|
@ -28,7 +28,9 @@ actix-macros = { version = "0.2.0", optional = true }
|
||||||
|
|
||||||
futures-core = { version = "0.3", default-features = false }
|
futures-core = { version = "0.3", default-features = false }
|
||||||
tokio = { version = "1.3", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
|
tokio = { version = "1.3", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
|
||||||
tokio-uring = { git = "https://github.com/tokio-rs/tokio-uring.git", optional = true }
|
|
||||||
|
[target."cfg(target_os = \"linux\")".dependencies]
|
||||||
|
tokio-uring = { version = "0.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1.2", features = ["full"] }
|
tokio = { version = "1.2", features = ["full"] }
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub struct Arbiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Arbiter {
|
impl Arbiter {
|
||||||
#[cfg(not(feature = "io-uring"))]
|
#[cfg(any(not(target_os = "linux"), not(feature = "io-uring")))]
|
||||||
/// Spawn a new Arbiter thread and start its event loop.
|
/// Spawn a new Arbiter thread and start its event loop.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
|
@ -104,7 +104,7 @@ impl Arbiter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "io-uring"))]
|
#[cfg(any(not(target_os = "linux"), not(feature = "io-uring")))]
|
||||||
/// Spawn a new Arbiter using the [Tokio Runtime](tokio-runtime) returned from a closure.
|
/// Spawn a new Arbiter using the [Tokio Runtime](tokio-runtime) returned from a closure.
|
||||||
///
|
///
|
||||||
/// [tokio-runtime]: tokio::runtime::Runtime
|
/// [tokio-runtime]: tokio::runtime::Runtime
|
||||||
|
@ -159,7 +159,7 @@ impl Arbiter {
|
||||||
Arbiter { tx, thread_handle }
|
Arbiter { tx, thread_handle }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "io-uring")]
|
#[cfg(all(target_os = "linux", feature = "io-uring"))]
|
||||||
/// Spawn a new Arbiter thread and start its event loop with `tokio-uring` runtime.
|
/// Spawn a new Arbiter thread and start its event loop with `tokio-uring` runtime.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
|
|
|
@ -302,7 +302,7 @@ fn try_current_with_system() {
|
||||||
System::new().block_on(async { assert!(System::try_current().is_some()) });
|
System::new().block_on(async { assert!(System::try_current().is_some()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "io-uring")]
|
#[cfg(all(target_os = "linux", feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn tokio_uring_arbiter() {
|
fn tokio_uring_arbiter() {
|
||||||
let system = System::new();
|
let system = System::new();
|
||||||
|
|
|
@ -280,7 +280,7 @@ impl ServerWorker {
|
||||||
let counter_clone = counter.clone();
|
let counter_clone = counter.clone();
|
||||||
// every worker runs in it's own arbiter.
|
// every worker runs in it's own arbiter.
|
||||||
// use a custom tokio runtime builder to change the settings of runtime.
|
// use a custom tokio runtime builder to change the settings of runtime.
|
||||||
#[cfg(feature = "io-uring")]
|
#[cfg(all(target_os = "linux", feature = "io-uring"))]
|
||||||
let arbiter = {
|
let arbiter = {
|
||||||
// TODO: pass max blocking thread config when tokio-uring enable configuration
|
// TODO: pass max blocking thread config when tokio-uring enable configuration
|
||||||
// on building runtime.
|
// on building runtime.
|
||||||
|
@ -288,7 +288,7 @@ impl ServerWorker {
|
||||||
Arbiter::new()
|
Arbiter::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "io-uring"))]
|
#[cfg(any(not(target_os = "linux"), not(feature = "io-uring")))]
|
||||||
let arbiter = Arbiter::with_tokio_rt(move || {
|
let arbiter = Arbiter::with_tokio_rt(move || {
|
||||||
tokio::runtime::Builder::new_current_thread()
|
tokio::runtime::Builder::new_current_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
|
|
Loading…
Reference in New Issue