mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
tweaks
This commit is contained in:
@@ -646,7 +646,7 @@ impl Core {
|
|||||||
/// workers will be trying to steal at the same time.
|
/// workers will be trying to steal at the same time.
|
||||||
fn steal_work(&mut self, worker: &Worker) -> Option<Notified> {
|
fn steal_work(&mut self, worker: &Worker) -> Option<Notified> {
|
||||||
#[cfg(not(loom))]
|
#[cfg(not(loom))]
|
||||||
const ATTEMPTS: usize = 4;
|
const ATTEMPTS: usize = 2;
|
||||||
|
|
||||||
#[cfg(loom)]
|
#[cfg(loom)]
|
||||||
const ATTEMPTS: usize = 1;
|
const ATTEMPTS: usize = 1;
|
||||||
@@ -690,24 +690,24 @@ impl Core {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::thread::sleep(std::time::Duration::from_micros(backoff));
|
||||||
|
backoff *= 2;
|
||||||
|
|
||||||
// Fallback on checking the global queue
|
// Fallback on checking the global queue
|
||||||
if let Some(task) = worker.handle.shared.inject.pop() {
|
if let Some(task) = worker.handle.shared.inject.pop() {
|
||||||
return Some(task);
|
return Some(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::thread::sleep(std::time::Duration::from_micros(backoff));
|
|
||||||
backoff *= 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transition_to_searching(&mut self, worker: &Worker) -> bool {
|
fn transition_to_searching(&mut self, worker: &Worker) -> bool {
|
||||||
if did_defer_tasks() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.is_searching {
|
if !self.is_searching {
|
||||||
|
if did_defer_tasks() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
self.is_searching = worker
|
self.is_searching = worker
|
||||||
.handle
|
.handle
|
||||||
.shared
|
.shared
|
||||||
|
|||||||
Reference in New Issue
Block a user