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

Function block_on

src/thread_pool.rs:2383–2392  ·  view source on GitHub ↗

Waits for a future to complete. When executed on a thread that is currently registered as a worker (i.e. the closure inside [`Membership::activate`], [`ThreadPool::with_worker`], or similar) this is able to look up that registration and find the worker and thread-pool implicitly. If not called within a thread pool, this uses the [`DEFAULT_POOL`]. If you have a reference to a [`Worker`], it's be

(future: F)

Source from the content-addressed store, hash-verified

2381 // every `StackJob` and returned: unwinding is ruled out by the
2382 // abort guard held until every latch is set, which turns a
2383 // panic that would unwind this frame into an abort. (Jobs
2384 // executed while waiting never allow panics to escape their
2385 // execution -- see the panic convention on `JobRef` -- so only
2386 // unexpected panics can trip the guard.) No `StackJob` is moved
2387 // or dropped before then.
2388 let job_ref = unsafe { job.as_job_ref() };
2389 self.member_data.broadcasts[*member_index].push(job_ref);
2390 self.member_data.semaphores[*member_index].signal();
2391 }
2392
2393 // Wait for each job to finish.
2394 let error_flags: Vec<_> = jobs
2395 .iter()

Callers 1

block_onMethod · 0.85

Calls 1

block_onMethod · 0.80

Tested by

no test coverage detected