Compare commits
1 Commits
renovate/c
...
main
Author | SHA1 | Date | |
---|---|---|---|
119fb101cf |
@@ -3,6 +3,24 @@ use std::{future::Future, sync::Arc};
|
|||||||
use tokio::{sync::Mutex, task::JoinHandle};
|
use tokio::{sync::Mutex, task::JoinHandle};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
|
pub mod extensions {
|
||||||
|
use crate::Workers;
|
||||||
|
|
||||||
|
pub trait WithSysLimitCpus {
|
||||||
|
fn with_limit_to_system_cpus(&mut self) -> &mut Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WithSysLimitCpus for Workers {
|
||||||
|
fn with_limit_to_system_cpus(&mut self) -> &mut Self {
|
||||||
|
self.with_limit(
|
||||||
|
std::thread::available_parallelism()
|
||||||
|
.expect("to be able to get system cpu info")
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type ErrChan = Arc<
|
type ErrChan = Arc<
|
||||||
Mutex<(
|
Mutex<(
|
||||||
Option<tokio::sync::oneshot::Sender<anyhow::Error>>,
|
Option<tokio::sync::oneshot::Sender<anyhow::Error>>,
|
||||||
|
Reference in New Issue
Block a user