Stop the Windows timer thread cooperatively - #838
Open
kevinushey wants to merge 2 commits into
Open
kevinushey wants to merge 2 commits into
kevinushey wants to merge 2 commits into
Conversation
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.
Loading cli starts a timer thread that Windows cleanup currently cancels asynchronously, without waiting for it to terminate. Signal a stop event and join the worker instead, so it returns normally before its resources are released or its DLL is unloaded. Signaling the event wakes the worker immediately, even with a long tick interval.
This removes the architecture-specific cancellation workaround and the unchecked
getenv("PROCESSOR_ARCHITECTURE")argument tostrcmp(). The Unix worker retains its existing behavior.Add Windows subprocess tests for missing architecture variables, timer restart, disabling the thread, process exit, and repeated namespace/DLL unloading. Long timer intervals and bounded subprocess timeouts check that shutdown does not wait for the next tick.
Related to #375 (recent report) and #494. The reported Windows crash has not been reproduced locally, so this is a candidate remedy that still needs confirmation on the affected installation.
Validation:
NO_COLORunset. Four skips are the new Windows tests; two require source references.src/thread.cfor Windows x64 with MinGW GCC 14.2, POSIX threads, and warnings treated as errors. This checks compilation against Windows APIs; it is not a complete Rtools build or a native Windows runtime test.git diff --checkpasses.