diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-27 17:41:07 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-27 17:41:07 +0530 |
| commit | 5a02743c0c9563f41a8c3821a7bbce4fc3b0b839 (patch) | |
| tree | f36aa805b8c90a8d786e8561a9d84f57e6191c19 /src/main.c | |
| parent | d87b4744bed8f0c43e11ea12508ef2941bdd7186 (diff) | |
bug fixes
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -67,6 +67,9 @@ skip_refresh: break; } if (is_stop) { + // cooperative stop: signal all threads, wait for them to finish + threads_stop_all(&engine_threads); + threads_join(&engine_threads); threads_cleanup(&engine_threads); ipc_state_set_event(&ipc_state, EVENT_UCI_RUNNING); goto waiting_for_go; @@ -76,6 +79,12 @@ skip_refresh: } quit: + // cooperative stop for engine threads, then hard-cancel the UCI thread + // (which blocks on stdin and cannot exit cooperatively). + if (engine_threads.running_count > 0) { + threads_stop_all(&engine_threads); + threads_join(&engine_threads); + } ipc_state_deinit(&ipc_state); pthread_cancel(uci_thread); threads_deinit(&engine_threads); |
