File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ stable_deref_trait = { version = "1", default-features = false }
7575[dev-dependencies ]
7676critical-section = { version = " 1.1" , features = [" std" ] }
7777static_assertions = " 1.1.0"
78- loom = " 0.7"
78+ loom = { version = " 0.7" , git = " https://github.com/akonradi/loom " , branch = " scoped-thread " }
7979
8080[package .metadata .docs .rs ]
8181features = [
Original file line number Diff line number Diff line change @@ -505,4 +505,30 @@ mod tests {
505505 } ) ;
506506 } ) ;
507507 }
508+
509+ #[ test]
510+ fn issue_583_enqueue_loom_scope ( ) {
511+ const N : usize = 4 ;
512+
513+ loom:: model ( || {
514+ let q0 = Queue :: < u8 , N > :: new ( ) ;
515+ for i in 0 ..N {
516+ q0. enqueue ( i as u8 ) . expect ( "new enqueue" ) ;
517+ }
518+ eprintln ! ( "start!" ) ;
519+
520+ loom:: thread:: scope ( |sc| {
521+ for _ in 0 ..2 {
522+ sc. spawn ( || {
523+ for k in 0 ..1000_000 {
524+ if let Some ( v) = q0. dequeue ( ) {
525+ q0. enqueue ( v)
526+ . unwrap_or_else ( |v| panic ! ( "{k}: q0 -> q0: {v}, {:?}" , to_vec( & q0) ) ) ;
527+ }
528+ }
529+ } ) ;
530+ }
531+ } ) ;
532+ } ) ;
533+ }
508534}
You can’t perform that action at this time.
0 commit comments