MSW: make interrupting Maxima more robust (#2289) - #2402
Merged
Merged
Conversation
The interrupt sets a bit in a shared-memory segment named after the Lisp's pid. That pid is only known if Maxima's first prompt reported it; otherwise the name was built from the pid of maxima.bat and the segment wasn't found. Now every process below the one wxMaxima started is tried as well (DescendantPids(), a pure function with a unit test). The fallback sent a Ctrl+C to wxMaxima's own console, which wxmaxima.exe, a GUI-subsystem program, does not have. It now attaches to Maxima's hidden console for that. FormatMessage() was handed the buffer pointer instead of its address, so the reason Windows gave for a failure was always lost; it is reported now, together with the segment names that were tried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUfW6XqBP4WxRKwDCu4dBS
It never worked: wxmaxima.exe has no console to send a Ctrl+C from, and Maxima leads a new process group, which ignores Ctrl+C. A failed interrupt now says so instead of trying it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUfW6XqBP4WxRKwDCu4dBS
gunterkoenigsmann
marked this pull request as ready for review
September 29, 2026 17:01
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.
Requested by Gunter · project thread
Before: On some Windows systems Ctrl+G only showed "Could not send an interrupt signal to maxima.", and the user had to restart Maxima and lost the session (#2289). The message never said why.
After: wxMaxima now finds the Lisp's shared-memory segment even when Maxima didn't report its pid. When interrupting fails, the log says which segments were tried and what Windows reported. The console Ctrl+C fallback is gone, because it never worked.
How:
gcl-<pid>ormaxima-<pid>, named after the Lisp's pid. We only know that pid if Maxima's first prompt reported it; otherwise the name was built frommaxima.bat's pid and never matched. Now every process below the one we started is tried as well. The process-tree walk is a pure, portable function,DescendantPids()insrc/ProcessTree.{h,cpp}, with a unit test that covers reused pids and cycles.wxmaxima.exeis a GUI-subsystem program without one, and Maxima leads a new process group, which ignores Ctrl+C.FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER …)was passed the buffer pointer instead of its address, so Windows' error text was always lost. It is now passed correctly.The real fix for threaded Lisps, a channel of wxMaxima's own, is #2405, which is stacked on this PR.
Testing: the Linux build is clean and all unit tests pass, including the new
ProcessTreetest. The Windows-only code compiles with MinGW-w64 against stubbed wx types; the minGW CI job does the real build. Not tested on real Windows.🤖 Generated with Claude Code
https://claude.ai/code/session_01BUfW6XqBP4WxRKwDCu4dBS