@@ -219,7 +219,7 @@ impl Machine {
219
219
runs = 0 ;
220
220
rt. quick_poll ( ) . unwrap ( ) ;
221
221
222
- let p = self . processor . lock ( ) ;
222
+ let mut p = self . processor . lock ( ) ;
223
223
if let Steal :: Success ( task) = p. steal_from_global ( rt) {
224
224
p. schedule ( rt, task) ;
225
225
}
@@ -284,21 +284,21 @@ struct Processor {
284
284
worker : Worker < Runnable > ,
285
285
286
286
/// Contains the next task to run as an optimization that skips the queue.
287
- slot : Cell < Option < Runnable > > ,
287
+ slot : Option < Runnable > ,
288
288
}
289
289
290
290
impl Processor {
291
291
/// Creates a new processor.
292
292
fn new ( ) -> Processor {
293
293
Processor {
294
294
worker : Worker :: new_fifo ( ) ,
295
- slot : Cell :: new ( None ) ,
295
+ slot : None ,
296
296
}
297
297
}
298
298
299
299
/// Schedules a task to run on this processor.
300
- fn schedule ( & self , rt : & Runtime , task : Runnable ) {
301
- match self . slot . replace ( Some ( task) ) {
300
+ fn schedule ( & mut self , rt : & Runtime , task : Runnable ) {
301
+ match self . slot . replace ( task) {
302
302
None => { }
303
303
Some ( task) => {
304
304
self . worker . push ( task) ;
@@ -308,15 +308,15 @@ impl Processor {
308
308
}
309
309
310
310
/// Flushes a task from the slot into the local queue.
311
- fn flush_slot ( & self , rt : & Runtime ) {
311
+ fn flush_slot ( & mut self , rt : & Runtime ) {
312
312
if let Some ( task) = self . slot . take ( ) {
313
313
self . worker . push ( task) ;
314
314
rt. notify ( ) ;
315
315
}
316
316
}
317
317
318
318
/// Pops a task from this processor.
319
- fn pop_task ( & self ) -> Option < Runnable > {
319
+ fn pop_task ( & mut self ) -> Option < Runnable > {
320
320
self . slot . take ( ) . or_else ( || self . worker . pop ( ) )
321
321
}
322
322
0 commit comments