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

Function spawn_broadcast

src/thread_pool.rs:2478–2486  ·  view source on GitHub ↗

Runs an operation on multiple threads without waiting for results. 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

(f: F)

Source from the content-addressed store, hash-verified

2476 };
2477
2478 // SAFETY: `op` cannot unwind. All user code is wrapped in
2479 // `halt_unwinding` and `handle_panic` does not unwind.
2480 let job = unsafe { HeapJob::new(op) };
2481
2482 // SAFETY: `HeapJob::into_job_ref` has two preconditions:
2483 //
2484 // * The `JobRef` must not outlive any of the items closed over by
2485 // `op`.
2486 //
2487 // `op` owns an `Arc<F>` clone (`func`). Since `F: 'static`, that
2488 // `Arc` and everything it keeps alive is itself `'static`,
2489 // so it outlives the `JobRef` regardless of when the job runs.

Callers

nothing calls this directly

Calls 1

spawn_broadcastMethod · 0.45

Tested by

no test coverage detected