parent
60b324f677
commit
1d1bf077bc
@ -1,69 +0,0 @@
|
||||
From aaf3296c9470a094f740d004444b45065d00a730 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Stone <cuviper@gmail.com>
|
||||
Date: Wed, 12 Jun 2019 20:45:51 -0700
|
||||
Subject: [PATCH] Update to crossbeam-deque 0.7
|
||||
|
||||
---
|
||||
src/registry.rs | 28 ++++++++++------------------
|
||||
1 file changed, 10 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/registry.rs b/src/registry.rs
|
||||
index 76567c3703e6..3171d0041d34 100644
|
||||
--- a/src/registry.rs
|
||||
+++ b/src/registry.rs
|
||||
@@ -1,4 +1,4 @@
|
||||
-use crossbeam_deque::{self as deque, Pop, Steal, Stealer, Worker};
|
||||
+use crossbeam_deque::{Steal, Stealer, Worker};
|
||||
use crossbeam_queue::SegQueue;
|
||||
#[cfg(rayon_unstable)]
|
||||
use internal::task::Task;
|
||||
@@ -222,15 +222,13 @@ impl Registry {
|
||||
let n_threads = builder.get_num_threads();
|
||||
let breadth_first = builder.get_breadth_first();
|
||||
|
||||
- let (workers, stealers): (Vec<_>, Vec<_>) = (0..n_threads)
|
||||
- .map(|_| {
|
||||
- if breadth_first {
|
||||
- deque::fifo()
|
||||
- } else {
|
||||
- deque::lifo()
|
||||
- }
|
||||
- })
|
||||
- .unzip();
|
||||
+ let new = if breadth_first {
|
||||
+ Worker::new_fifo
|
||||
+ } else {
|
||||
+ Worker::new_lifo
|
||||
+ };
|
||||
+ let workers: Vec<_> = (0..n_threads).map(|_| new()).collect();
|
||||
+ let stealers: Vec<_> = workers.iter().map(Worker::stealer).collect();
|
||||
|
||||
let registry = Arc::new(Registry {
|
||||
thread_infos: stealers.into_iter().map(ThreadInfo::new).collect(),
|
||||
@@ -674,13 +672,7 @@ impl WorkerThread {
|
||||
/// bottom.
|
||||
#[inline]
|
||||
pub(super) unsafe fn take_local_job(&self) -> Option<JobRef> {
|
||||
- loop {
|
||||
- match self.worker.pop() {
|
||||
- Pop::Empty => return None,
|
||||
- Pop::Data(d) => return Some(d),
|
||||
- Pop::Retry => {}
|
||||
- }
|
||||
- }
|
||||
+ self.worker.pop()
|
||||
}
|
||||
|
||||
/// Wait until the latch is set. Try to keep busy by popping and
|
||||
@@ -763,7 +755,7 @@ impl WorkerThread {
|
||||
loop {
|
||||
match victim.stealer.steal() {
|
||||
Steal::Empty => return None,
|
||||
- Steal::Data(d) => {
|
||||
+ Steal::Success(d) => {
|
||||
log!(StoleWork {
|
||||
worker: self.index,
|
||||
victim: victim_index
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- rayon-core-1.5.0/Cargo.toml 1970-01-01T00:00:00+00:00
|
||||
+++ rayon-core-1.5.0/Cargo.toml 2019-06-13T04:01:24.258939+00:00
|
||||
@@ -49,7 +49,7 @@
|
||||
name = "scoped_threadpool"
|
||||
path = "tests/scoped_threadpool.rs"
|
||||
[dependencies.crossbeam-deque]
|
||||
-version = "0.6.3"
|
||||
+version = "0.7.1"
|
||||
|
||||
[dependencies.crossbeam-queue]
|
||||
version = "0.1.2"
|
@ -1 +1 @@
|
||||
SHA512 (rayon-core-1.5.0.crate) = 7221e0e629e923aae2a2ff8e000c58ecc06fd71c00c2988a7664bd452464e210609e5f738c72bf8985ebbefb751f574de657d73189921ce9ee113594e72ccec9
|
||||
SHA512 (rayon-core-1.6.0.crate) = 78f231633fb2382fd38a89b967f5a2f38e611293a19db342039e63fd0c7cffd33a78d18b8f0788089b157373ebf20eae0c88365be9668f48abc3a390130be36c
|
||||
|
Loading…
Reference in new issue