|
0 |
From e11aad9ff20deede59e89a00c62908ffb30b8fb6 Mon Sep 17 00:00:00 2001
|
|
1 |
From: Aaron Hill <aa1ronham@gmail.com>
|
|
2 |
Date: Sun, 7 Jul 2019 14:47:20 -0400
|
|
3 |
Subject: [PATCH] Update crossbeam-deque to 0.7
|
|
4 |
|
|
5 |
The only substantive change is to 'take_local_job'.
|
|
6 |
'Worker::pop` now returns a plain 'Option<T>', so there's
|
|
7 |
no need to loop anymore
|
|
8 |
|
|
9 |
diff --git a/src/registry.rs b/src/registry.rs
|
|
10 |
index 76567c37..928ba017 100644
|
|
11 |
--- a/src/registry.rs
|
|
12 |
+++ b/src/registry.rs
|
|
13 |
@@ -1,4 +1,4 @@
|
|
14 |
-use crossbeam_deque::{self as deque, Pop, Steal, Stealer, Worker};
|
|
15 |
+use crossbeam_deque::{self as deque, Steal, Stealer, Worker};
|
|
16 |
use crossbeam_queue::SegQueue;
|
|
17 |
#[cfg(rayon_unstable)]
|
|
18 |
use internal::task::Task;
|
|
19 |
@@ -224,11 +224,14 @@ impl Registry {
|
|
20 |
|
|
21 |
let (workers, stealers): (Vec<_>, Vec<_>) = (0..n_threads)
|
|
22 |
.map(|_| {
|
|
23 |
- if breadth_first {
|
|
24 |
- deque::fifo()
|
|
25 |
+ let worker = if breadth_first {
|
|
26 |
+ deque::Worker::new_fifo()
|
|
27 |
} else {
|
|
28 |
- deque::lifo()
|
|
29 |
- }
|
|
30 |
+ deque::Worker::new_lifo()
|
|
31 |
+ };
|
|
32 |
+
|
|
33 |
+ let stealer = worker.stealer();
|
|
34 |
+ (worker, stealer)
|
|
35 |
})
|
|
36 |
.unzip();
|
|
37 |
|
|
38 |
@@ -674,13 +677,7 @@ impl WorkerThread {
|
|
39 |
/// bottom.
|
|
40 |
#[inline]
|
|
41 |
pub(super) unsafe fn take_local_job(&self) -> Option<JobRef> {
|
|
42 |
- loop {
|
|
43 |
- match self.worker.pop() {
|
|
44 |
- Pop::Empty => return None,
|
|
45 |
- Pop::Data(d) => return Some(d),
|
|
46 |
- Pop::Retry => {}
|
|
47 |
- }
|
|
48 |
- }
|
|
49 |
+ self.worker.pop()
|
|
50 |
}
|
|
51 |
|
|
52 |
/// Wait until the latch is set. Try to keep busy by popping and
|
|
53 |
@@ -763,7 +760,7 @@ impl WorkerThread {
|
|
54 |
loop {
|
|
55 |
match victim.stealer.steal() {
|
|
56 |
Steal::Empty => return None,
|
|
57 |
- Steal::Data(d) => {
|
|
58 |
+ Steal::Success(d) => {
|
|
59 |
log!(StoleWork {
|
|
60 |
worker: self.index,
|
|
61 |
victim: victim_index
|