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

Function scope_update_tree

src/scope.rs:1311–1327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1309
1310 let v = counter.load(Ordering::SeqCst);
1311 assert_eq!(v, 11);
1312
1313 THREAD_POOL.depopulate();
1314 }
1315
1316 /// Test that it is possible to borrow local data within a scope, modify it,
1317 /// and then read it later. This is mostly here to ensure stuff like this
1318 /// compiles.
1319 #[test]
1320 fn scope_borrow() {
1321 static THREAD_POOL: ThreadPool = ThreadPool::new();
1322 THREAD_POOL.resize_to_available();
1323
1324 let mut string = "a";
1325 THREAD_POOL.scope(|scope| {
1326 scope.spawn(|_: &Worker| {
1327 string = "b";
1328 });
1329 });
1330 assert_eq!(string, "b");

Callers

nothing calls this directly

Calls 6

random_treeFunction · 0.85
resize_to_availableMethod · 0.80
with_workerMethod · 0.80
iterMethod · 0.80
updateMethod · 0.80
depopulateMethod · 0.80

Tested by

no test coverage detected