@@ -377,7 +377,7 @@ fn use_lock(mutex: &Mutex<Vec<i32>>) {
377
377
let vec = access (& mut guard );
378
378
379
379
// vec has type `&mut Vec<i32>`
380
- vec . push (3 );
380
+ vec . push (3 );sc
381
381
382
382
// lock automatically released here, when `guard` is destroyed
383
383
}
@@ -475,6 +475,12 @@ Disaster averted.
475
475
476
476
### Sharing the stack: "scoped"
477
477
478
+ _ Note: The API mentioned here is an old one which has been moved out of
479
+ the standard library. You can find equivalent functionality in
480
+ [ ` crossbeam ` ] [ crossbeam-crate ] ([ documentation for ` scope() ` ] [ crossbeam-doc ] )
481
+ and [ ` scoped_threadpool ` ] [ scoped-threadpool-crate ]
482
+ ([ documentation for ` scoped() ` ] [ scoped-threadpool-doc ] )_
483
+
478
484
So far, all the patterns we've seen involve creating data structures
479
485
on the heap that get shared between threads. But what if we wanted to
480
486
start some threads that make use of data living in our stack frame?
@@ -611,3 +617,7 @@ months. Stay tuned!
611
617
[ scoped ] : http://static.rust-lang.org/doc/master/std/thread/fn.scoped.html
612
618
[ syncbox ] : https://github.com/carllerche/syncbox
613
619
[ simple_parallel ] : https://github.com/huonw/simple_parallel
620
+ [ crossbeam-crate ] : https://crates.io/crates/crossbeam
621
+ [ crossbeam-doc ] : http://aturon.github.io/crossbeam-doc/crossbeam/fn.scope.html
622
+ [ scoped-threadpool-crate ] : https://crates.io/crates/scoped_threadpool
623
+ [ scoped-threadpool-doc ] : http://kimundi.github.io/scoped-threadpool-rs/scoped_threadpool/index.html#examples:
0 commit comments