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

Method update_in_scope

src/scope.rs:1350–1368  ·  view source on GitHub ↗
(
            &'env mut self,
            scope: &'scope Scope<'scope, 'env>,
            op: &'scope OP,
        )

Source from the content-addressed store, hash-verified

1348 counter.fetch_add(1, Ordering::Relaxed);
1349 });
1350 });
1351 scope.spawn(|_: &Worker| {
1352 counter.fetch_add(1, Ordering::Relaxed);
1353 scope.spawn(|_: &Worker| {
1354 counter.fetch_add(1, Ordering::Relaxed);
1355 });
1356 });
1357 });
1358 assert_eq!(counter.load(Ordering::Relaxed), 4);
1359
1360 THREAD_POOL.depopulate();
1361 }
1362
1363 /// Tests that we can spawn futures onto the thread pool and that they can
1364 /// borrow data as expected.
1365 #[test]
1366 fn scope_future() {
1367 static THREAD_POOL: ThreadPool = ThreadPool::new();
1368 THREAD_POOL.resize_to_available();
1369
1370 let mut value = 0;
1371 THREAD_POOL.scope(|scope| {

Callers 1

updateMethod · 0.80

Calls 1

spawnMethod · 0.45

Tested by

no test coverage detected