fix(rsp): cancel arena compare background thread when TUI exits#269
Merged
elliottneilclark merged 1 commit intomasterfrom Apr 15, 2026
Merged
fix(rsp): cancel arena compare background thread when TUI exits#269elliottneilclark merged 1 commit intomasterfrom
elliottneilclark merged 1 commit intomasterfrom
Conversation
`run_comparison_with_tui` spawned the comparison thread, dropped the `JoinHandle`, and swallowed `tx.send` errors inside the callback — so after the user quit the TUI the comparison kept running, allocating a full CFR tree per remaining permutation, and the temp output directory could be dropped out from under the OHH historian. Add `ArenaComparison::run_with_cancellable_callback` that takes a closure returning `ControlFlow<()>` and short-circuits both the permutation loop and the outer game loop on `Break`. Keep the existing `run_with_callback` as a `Continue`-always convenience wrapper. Share an `Arc<AtomicBool>` between the TUI-side runner and the worker callback; the callback flips it on send failure and returns `Break` so the worker stops as soon as the current permutation ends. Keep the worker's `JoinHandle`, set the flag once the TUI event loop returns, and `join()` the handle before returning — that keeps any caller-owned temp directory alive until the OHH historian is done writing. Add a regression test that `run_with_cancellable_callback` stops after ~3 permutations instead of running all 100 configured games.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run_comparison_with_tuispawned the comparison thread, dropped theJoinHandle, and swallowedtx.senderrors inside the callback — soafter the user quit the TUI the comparison kept running, allocating a
full CFR tree per remaining permutation, and the temp output directory
could be dropped out from under the OHH historian.
Add
ArenaComparison::run_with_cancellable_callbackthat takes aclosure returning
ControlFlow<()>and short-circuits both thepermutation loop and the outer game loop on
Break. Keep the existingrun_with_callbackas aContinue-always convenience wrapper.Share an
Arc<AtomicBool>between the TUI-side runner and the workercallback; the callback flips it on send failure and returns
Breakso the worker stops as soon as the current permutation ends. Keep the
worker's
JoinHandle, set the flag once the TUI event loop returns,and
join()the handle before returning — that keeps any caller-ownedtemp directory alive until the OHH historian is done writing.
Add a regression test that
run_with_cancellable_callbackstops after~3 permutations instead of running all 100 configured games.