| 1396 | } |
| 1397 | |
| 1398 | void cbm_watcher_stop(cbm_watcher_t *w) { |
| 1399 | if (w) { |
| 1400 | atomic_store_explicit(&w->stopped, 1, memory_order_release); |
| 1401 | cbm_mutex_lock(&w->projects_lock); |
| 1402 | cbm_ht_foreach(w->projects, cancel_active_git_entry, NULL); |
| 1403 | for (int i = 0; i < w->pending_free_count; i++) { |
| 1404 | project_state_t *state = w->pending_free[i]; |
| 1405 | if (state && state->active_git) { |
| 1406 | (void)cbm_subprocess_request_cancel(state->active_git); |
| 1407 | } |
| 1408 | } |
| 1409 | cbm_mutex_unlock(&w->projects_lock); |
| 1410 | } |
| 1411 | } |
| 1412 | |
| 1413 | int cbm_watcher_run(cbm_watcher_t *w, int base_interval_ms) { |
| 1414 | if (!w) { |