MCPcopy Create free account
hub / github.com/NthTensor/Forte / scope_linear_stack_growth

Function scope_linear_stack_growth

src/scope.rs:1402–1423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1400 let s = counter_s.load(Ordering::SeqCst);
1401 assert_eq!(p, s);
1402
1403 THREAD_POOL.depopulate();
1404 }
1405
1406 fn divide_and_conquer<'scope, 'env>(
1407 scope: &'scope Scope<'scope, 'env>,
1408 counter: &'scope AtomicUsize,
1409 size: usize,
1410 ) {
1411 if size > 1 {
1412 scope.spawn(move |_: &Worker| {
1413 divide_and_conquer(scope, counter, size / 2)
1414 });
1415 scope.spawn(move |_: &Worker| {
1416 divide_and_conquer(scope, counter, size / 2)
1417 });
1418 } else {
1419 // count the leaves
1420 counter.fetch_add(1, Ordering::SeqCst);
1421 }
1422 }
1423
1424 fn divide_and_conquer_seq(counter: &AtomicUsize, size: usize) {
1425 if size > 1 {
1426 divide_and_conquer_seq(counter, size / 2);

Callers

nothing calls this directly

Calls 5

scopeFunction · 0.85
the_final_countdownFunction · 0.85
resize_to_availableMethod · 0.80
with_workerMethod · 0.80
depopulateMethod · 0.80

Tested by

no test coverage detected