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

Function scope_static

src/scope.rs:1598–1620  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1596 /// Tests that panics within nested scoped spawns are propagated.
1597 #[test]
1598 #[should_panic(expected = "Hello, world!")]
1599 fn scope_panic_propagate_from_nested_spawn() {
1600 static THREAD_POOL: ThreadPool = ThreadPool::new();
1601 THREAD_POOL.resize_to_available();
1602
1603 THREAD_POOL.scope(|scope| {
1604 scope.spawn(|_: &Worker| {
1605 scope.spawn(|_: &Worker| {
1606 scope.spawn(|_: &Worker| panic!("Hello, world!"))
1607 })
1608 })
1609 });
1610
1611 THREAD_POOL.depopulate();
1612 }
1613
1614 /// Tests that panics within nested scopes are propagated.
1615 #[test]
1616 #[should_panic(expected = "Hello, world!")]
1617 fn scope_panic_propagate_from_nested_scope_spawn() {
1618 static THREAD_POOL: ThreadPool = ThreadPool::new();
1619 THREAD_POOL.resize_to_available();
1620
1621 THREAD_POOL.scope(|scope_1| {
1622 scope_1.spawn(|worker: &Worker| {
1623 worker.scope(|scope_2| {

Callers

nothing calls this directly

Calls 3

resize_to_availableMethod · 0.80
depopulateMethod · 0.80
spawnMethod · 0.45

Tested by

no test coverage detected