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 // SAFETY: We are only allowed to create a `JobRef` to this `StackJob`
2382 // if we can show that...
2383 //
2384 // * `as_job_ref` is called at most once for this `StackJob`.
2385 //
2386 // The `StackJob` is only accessible in this function (it is
2387 // created here, dropped here, and no direct references escape
2388 // this scope), and within this function we only call `as_job_ref`
2389 // once.
2390 //
2391 // * The `StackJob` will not be moved or dropped until either:
2392 //
2393 // A. A call to `check` on the enclosed `Latch` returns something
2394 // other than `Pending`.
2395 //

Callers 1

block_onMethod · 0.85

Calls 1

block_onMethod · 0.80

Tested by

no test coverage detected