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

Function racing_sweep_hook

tests/test_pipeline.c:6137–6147  ·  view source on GitHub ↗

Fired from inside the FIRST run's create_staging_path(), the instant its * stage main file exists (under the fix, with its sidecar lock already held; * under the old create-then-lock ordering, before the lock was taken): run a * second, cancelled cbm_pipeline_run() for the same project synchronously on * another thread, so its sweep has every chance to reach the stage before * control returns

Source from the content-addressed store, hash-verified

6135 * another thread, so its sweep has every chance to reach the stage before
6136 * control returns to the first run. */
6137static void racing_sweep_hook(void *userdata) {
6138 racing_sweep_arg_t *a = (racing_sweep_arg_t *)userdata;
6139 char stage_path[600] = {0};
6140 bool had_stage =
6141 find_sole_stage_path(a->tmp_dir, "generation.db", stage_path, sizeof(stage_path));
6142 cbm_thread_t tid;
6143 if (cbm_thread_create(&tid, 0, racing_sweep_thread, a) == 0) {
6144 cbm_thread_join(&tid);
6145 }
6146 a->stage_survived = had_stage && path_exists(stage_path);
6147}
6148
6149TEST(pipeline_concurrent_sweep_must_not_remove_inflight_stage) {
6150 char tmp[256];

Callers

nothing calls this directly

Calls 4

find_sole_stage_pathFunction · 0.85
cbm_thread_createFunction · 0.85
cbm_thread_joinFunction · 0.85
path_existsFunction · 0.85

Tested by

no test coverage detected