mirror of https://github.com/fafhrd91/actix-net
Compare commits
4 Commits
389012a97a
...
d65d399376
Author | SHA1 | Date |
---|---|---|
|
d65d399376 | |
|
21de88385e | |
|
a91bdcb80c | |
|
192d0661e9 |
|
@ -64,7 +64,7 @@ jobs:
|
|||
toolchain: ${{ matrix.version }}
|
||||
|
||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||
|
||||
|
@ -121,7 +121,7 @@ jobs:
|
|||
toolchain: nightly
|
||||
|
||||
- name: Install cargo-hack & cargo-minimal-versions
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: cargo-hack,cargo-minimal-versions
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ jobs:
|
|||
toolchain: ${{ matrix.version.version }}
|
||||
|
||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||
|
||||
|
@ -125,7 +125,7 @@ jobs:
|
|||
toolchain: nightly
|
||||
|
||||
- name: Install just
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: just
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
components: llvm-tools-preview
|
||||
|
||||
- name: Install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: cargo-llvm-cov
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ jobs:
|
|||
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||
|
||||
- name: Install just
|
||||
uses: taiki-e/install-action@v2.55.1
|
||||
uses: taiki-e/install-action@v2.56.7
|
||||
with:
|
||||
tool: just
|
||||
|
||||
|
|
|
@ -944,6 +944,17 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-uring"
|
||||
version = "0.7.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipconfig"
|
||||
version = "0.3.2"
|
||||
|
@ -2115,17 +2126,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.45.1"
|
||||
version = "1.46.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
|
||||
checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"io-uring 0.7.8",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"socket2 0.5.10",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.52.0",
|
||||
|
@ -2236,7 +2249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "748482e3e13584a34664a710168ad5068e8cb1d968aa4ffa887e83ca6dd27967"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"io-uring",
|
||||
"io-uring 0.6.4",
|
||||
"libc",
|
||||
"slab",
|
||||
"socket2 0.4.10",
|
||||
|
|
|
@ -10,6 +10,7 @@ fn main() {
|
|||
.worker_threads(2)
|
||||
.enable_all()
|
||||
.build()
|
||||
.map(std::sync::Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
.block_on(async_main());
|
||||
|
|
|
@ -109,7 +109,7 @@ impl Arbiter {
|
|||
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime + Send + 'static,
|
||||
F: FnOnce() -> std::sync::Arc<tokio::runtime::Runtime> + Send + 'static,
|
||||
{
|
||||
let sys = System::current();
|
||||
let system_id = sys.id();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use std::{future::Future, io};
|
||||
|
||||
use std::{sync::Arc, future::Future, io};
|
||||
use tokio::task::{JoinHandle, LocalSet};
|
||||
|
||||
/// A Tokio-based runtime proxy.
|
||||
|
@ -9,14 +8,14 @@ use tokio::task::{JoinHandle, LocalSet};
|
|||
#[derive(Debug)]
|
||||
pub struct Runtime {
|
||||
local: LocalSet,
|
||||
rt: tokio::runtime::Runtime,
|
||||
rt: Arc<tokio::runtime::Runtime>,
|
||||
}
|
||||
|
||||
pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> {
|
||||
pub(crate) fn default_tokio_runtime() -> io::Result<Arc<tokio::runtime::Runtime>> {
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
.enable_time()
|
||||
.build()
|
||||
.build().map(Arc::new)
|
||||
}
|
||||
|
||||
impl Runtime {
|
||||
|
@ -141,6 +140,15 @@ impl Runtime {
|
|||
|
||||
impl From<tokio::runtime::Runtime> for Runtime {
|
||||
fn from(rt: tokio::runtime::Runtime) -> Self {
|
||||
Self {
|
||||
local: LocalSet::new(),
|
||||
rt: Arc::new(rt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Arc<tokio::runtime::Runtime>> for Runtime {
|
||||
fn from(rt: Arc<tokio::runtime::Runtime>) -> Self {
|
||||
Self {
|
||||
local: LocalSet::new(),
|
||||
rt,
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::{
|
|||
io,
|
||||
pin::Pin,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use futures_core::ready;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
|
||||
|
@ -48,7 +48,7 @@ impl System {
|
|||
/// [tokio-runtime]: tokio::runtime::Runtime
|
||||
pub fn with_tokio_rt<F>(runtime_factory: F) -> SystemRunner
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime,
|
||||
F: FnOnce() -> Arc<tokio::runtime::Runtime>,
|
||||
{
|
||||
let (stop_tx, stop_rx) = oneshot::channel();
|
||||
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
||||
|
@ -87,7 +87,7 @@ impl System {
|
|||
#[doc(hidden)]
|
||||
pub fn with_tokio_rt<F>(_: F) -> SystemRunner
|
||||
where
|
||||
F: FnOnce() -> tokio::runtime::Runtime,
|
||||
F: FnOnce() -> Arc<tokio::runtime::Runtime>,
|
||||
{
|
||||
unimplemented!("System::with_tokio_rt is not implemented for io-uring feature yet")
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
use actix_rt::{task::JoinError, Arbiter, System};
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
use {
|
||||
std::{sync::mpsc::channel, thread},
|
||||
std::{sync::Arc, sync::mpsc::channel, thread},
|
||||
tokio::sync::oneshot,
|
||||
};
|
||||
|
||||
|
@ -252,6 +252,7 @@ fn new_system_with_tokio() {
|
|||
.on_thread_start(|| {})
|
||||
.on_thread_stop(|| {})
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
.block_on(async {
|
||||
|
@ -284,6 +285,7 @@ fn new_arbiter_with_tokio() {
|
|||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
|
|
|
@ -425,6 +425,7 @@ impl ServerWorker {
|
|||
.enable_all()
|
||||
.max_blocking_threads(config.max_blocking_threads)
|
||||
.build()
|
||||
.map(Arc::new)
|
||||
.unwrap()
|
||||
})
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue