MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_parallel_for

Function cbm_parallel_for

src/pipeline/worker_pool.c:96–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94/* ── Public API ──────────────────────────────────────────────────── */
95
96void cbm_parallel_for(int count, cbm_parallel_fn fn, void *ctx, cbm_parallel_for_opts_t opts) {
97 if (count <= 0 || !fn) {
98 return;
99 }
100
101 /* Determine worker count */
102 int nworkers = opts.max_workers;
103 if (nworkers <= 0) {
104 nworkers = cbm_default_worker_count(true);
105 }
106 if (nworkers < WP_MIN) {
107 nworkers = SKIP_ONE;
108 }
109
110 /* Serial fallback: single worker or trivially small workload */
111 if (nworkers <= WP_MIN || count <= WP_MIN) {
112 run_serial(count, fn, ctx);
113 return;
114 }
115
116 run_pthreads(count, fn, ctx, nworkers);
117}

Callers 13

finalize_build_sourcesFunction · 0.85
finalize_pass1Function · 0.85
finalize_pass2Function · 0.85
phase1b_decode_and_buildFunction · 0.85
phase2_tokenizeFunction · 0.85
phase5_lsh_buildFunction · 0.85
phase6a_score_candidatesFunction · 0.85
cbm_parallel_extract_exFunction · 0.85
cbm_parallel_resolveFunction · 0.85

Calls 3

cbm_default_worker_countFunction · 0.85
run_serialFunction · 0.85
run_pthreadsFunction · 0.85

Tested by

no test coverage detected