(
depth: usize,
rng: &mut XorShift64Star,
)
| 1375 | assert!(completed); |
| 1376 | |
| 1377 | THREAD_POOL.depopulate(); |
| 1378 | } |
| 1379 | |
| 1380 | /// Tests that a serial and parallel version of a binary tree traversal |
| 1381 | /// produces the same output. |
| 1382 | #[test] |
| 1383 | fn scope_divide_and_conquer() { |
| 1384 | static THREAD_POOL: ThreadPool = ThreadPool::new(); |
| 1385 | THREAD_POOL.resize_to_available(); |
| 1386 | |
| 1387 | let counter_p = &AtomicUsize::new(0); |
| 1388 | THREAD_POOL.with_worker(|worker| { |
| 1389 | worker.scope(|scope| { |
| 1390 | scope.spawn(move |_: &Worker| { |
| 1391 | divide_and_conquer(scope, counter_p, 1024) |
| 1392 | }) |
| 1393 | }); |
| 1394 | }); |
| 1395 | |
| 1396 | let counter_s = &AtomicUsize::new(0); |
no test coverage detected