| 1778 | } |
| 1779 | |
| 1780 | void cbm_watcher_stop(cbm_watcher_t *w) { |
| 1781 | if (w) { |
| 1782 | atomic_store_explicit(&w->stopped, 1, memory_order_release); |
| 1783 | cbm_mutex_lock(&w->projects_lock); |
| 1784 | cbm_ht_foreach(w->projects, cancel_active_git_entry, NULL); |
| 1785 | for (int i = 0; i < w->pending_free_count; i++) { |
| 1786 | project_state_t *state = w->pending_free[i]; |
| 1787 | if (state && state->active_git) { |
| 1788 | (void)cbm_subprocess_request_cancel(state->active_git); |
| 1789 | } |
| 1790 | } |
| 1791 | cbm_mutex_unlock(&w->projects_lock); |
| 1792 | } |
| 1793 | } |
| 1794 | |
| 1795 | int cbm_watcher_run(cbm_watcher_t *w, int base_interval_ms) { |
| 1796 | if (!w) { |