@@ -53,16 +53,17 @@ use alloc::arc::Arc;
53
53
use clone:: Clone ;
54
54
use iter:: { range, Iterator } ;
55
55
use kinds:: Send ;
56
+ use kinds:: marker;
56
57
use mem:: { forget, min_align_of, size_of, transmute} ;
57
58
use ops:: Drop ;
58
59
use option:: { Option , Some , None } ;
59
60
use owned:: Box ;
60
61
use ptr:: RawPtr ;
61
62
use ptr;
63
+ use rt:: heap:: { allocate, deallocate} ;
62
64
use slice:: ImmutableVector ;
63
65
use sync:: atomics:: { AtomicInt , AtomicPtr , SeqCst } ;
64
66
use unstable:: sync:: Exclusive ;
65
- use rt:: heap:: { allocate, deallocate} ;
66
67
use vec:: Vec ;
67
68
68
69
// Once the queue is less than 1/K full, then it will be downsized. Note that
@@ -89,13 +90,15 @@ struct Deque<T> {
89
90
/// There may only be one worker per deque.
90
91
pub struct Worker < T > {
91
92
deque : Arc < Deque < T > > ,
93
+ noshare : marker:: NoShare ,
92
94
}
93
95
94
96
/// The stealing half of the work-stealing deque. Stealers have access to the
95
97
/// opposite end of the deque from the worker, and they only have access to the
96
98
/// `steal` method.
97
99
pub struct Stealer < T > {
98
100
deque : Arc < Deque < T > > ,
101
+ noshare : marker:: NoShare ,
99
102
}
100
103
101
104
/// When stealing some data, this is an enumeration of the possible outcomes.
@@ -153,7 +156,8 @@ impl<T: Send> BufferPool<T> {
153
156
pub fn deque ( & self ) -> ( Worker < T > , Stealer < T > ) {
154
157
let a = Arc :: new ( Deque :: new ( self . clone ( ) ) ) ;
155
158
let b = a. clone ( ) ;
156
- ( Worker { deque : a } , Stealer { deque : b } )
159
+ ( Worker { deque : a, noshare : marker:: NoShare } ,
160
+ Stealer { deque : b, noshare : marker:: NoShare } )
157
161
}
158
162
159
163
fn alloc ( & self , bits : int ) -> Box < Buffer < T > > {
@@ -219,7 +223,9 @@ impl<T: Send> Stealer<T> {
219
223
}
220
224
221
225
impl < T : Send > Clone for Stealer < T > {
222
- fn clone ( & self ) -> Stealer < T > { Stealer { deque : self . deque . clone ( ) } }
226
+ fn clone ( & self ) -> Stealer < T > {
227
+ Stealer { deque : self . deque . clone ( ) , noshare : marker:: NoShare }
228
+ }
223
229
}
224
230
225
231
// Almost all of this code can be found directly in the paper so I'm not
0 commit comments