MCPcopy Create free account
hub / github.com/Open-Quant/openquant / dispatch_async

Function dispatch_async

crates/openquant/src/hpc_parallel.rs:220–237  ·  view source on GitHub ↗
(
    atoms: Vec<A>,
    cfg: HpcParallelConfig,
    callback: F,
)

Source from the content-addressed store, hash-verified

218}
219
220pub fn dispatch_async<A, R, F, E>(
221 atoms: Vec<A>,
222 cfg: HpcParallelConfig,
223 callback: F,
224) -> AsyncParallelHandle<R>
225where
226 A: Send + Sync + 'static,
227 R: Send + 'static,
228 F: Fn(&[A]) -> Result<R, E> + Send + Sync + 'static,
229 E: Display + Send + 'static,
230{
231 let (tx, rx) = mpsc::channel();
232 let join_handle = thread::spawn(move || {
233 let report = run_parallel(&atoms, cfg, callback);
234 let _ = tx.send(report);
235 });
236 AsyncParallelHandle { join_handle, result_rx: rx }
237}
238
239fn run_serial<A, R, F, E>(
240 atoms: &[A],

Callers 1

Calls 1

run_parallelFunction · 0.85

Tested by 1