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
| 6135 | * another thread, so its sweep has every chance to reach the stage before |
| 6136 | * control returns to the first run. */ |
| 6137 | static 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 | |
| 6149 | TEST(pipeline_concurrent_sweep_must_not_remove_inflight_stage) { |
| 6150 | char tmp[256]; |
nothing calls this directly
no test coverage detected