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

Function pthread_worker

src/pipeline/worker_pool.c:69–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67#endif
68
69static void *pthread_worker(void *arg) {
70 pthread_worker_arg_t *wa = arg;
71 while (WP_TRUE) {
72 int idx = atomic_fetch_add_explicit(wa->next_idx, WP_STEP, memory_order_relaxed);
73 if (idx >= wa->count) {
74 break;
75 }
76 wa->fn(idx, wa->ctx);
77 }
78 /* This thread ends here: hand its pending memory-class deltas to the
79 * shared counters, so the phase mark that follows the join is exact. */
80 cbm_mem_class_flush_thread();
81 return NULL;
82}
83
84#if defined(CBM_MEMWASTE) && CBM_MEMWASTE
85static void run_pthreads_counted(int count, cbm_parallel_fn fn, void *ctx, int nworkers,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected