|
wxMaxima
|
The Maxima process/socket lifecycle extracted from the wxMaxima god class. More...
#include <MaximaProcessManager.h>
Public Member Functions | |
| MaximaProcessManager (wxMaxima &wxm) | |
| bool | StartServer () |
| Opens the local socket server Maxima connects back to. Returns false if no server could be created. | |
| void | ServerEvent (wxSocketEvent &event) |
| Handles a socket event on the server: on a connection, accepts it. | |
| void | OnMaximaConnect () |
| Accepts Maxima's connection to our server socket, wires up the data stream and kicks off the initial variable/setup queries. | |
| bool | StartMaxima (bool force=false) |
| (Re)starts the Maxima process (and its server socket) if needed. | |
| void | KillMaxima (bool logMessage=true) |
| Kills the Maxima process (and cleans up its temp files / registered PID). | |
| void | OnMaximaClose () |
| Reacts to the Maxima process having exited (reports it and, unless we closed it on purpose, tries to restart it). | |
| void | OnMaximaClose (wxProcessEvent &event) |
| wxEVT_END_PROCESS handler for the Maxima process; forwards to OnMaximaClose() if the PID matches. | |
| void | MaximaEvent (wxThreadEvent &event) |
| The EVT_MAXIMA handler: classifies each chunk Maxima sent over the socket and hands it to the matching reader / updates the status bar. | |
| bool | WriteToMaximaStdin (const wxString &line) |
| Writes one line of input to the Maxima process's stdin. | |
| void | Interrupt (wxCommandEvent &event) |
| Sends the running Maxima an interrupt (Ctrl+G / the interrupt button). | |
| void | GnuplotCommandName (wxString gnuplot) |
| Resolves the gnuplot executable path and (re)starts a background query of the graphics terminals it supports. | |
| void | OnGnuplotQueryTerminals (wxProcessEvent &event) |
| wxEVT_END_PROCESS handler for the gnuplot terminal-query subprocess: reads which terminals gnuplot supports and picks the plot driver. | |
| void | OnGnuplotClose (wxProcessEvent &event) |
| wxEVT_END_PROCESS handler for the gnuplot subprocess: notes it has closed. | |
Static Public Member Functions | |
| static void | RegisterChildMaxima (long pid) |
| Remember a running child Maxima's (group-leader) PID so a signal/crash handler can kill it. Async-signal-safe; no-op on Windows. | |
| static void | UnregisterChildMaxima (long pid) |
| Forget a child Maxima's PID once we have taken it down ourselves. Async-signal-safe; no-op on Windows. | |
| static void | KillAllChildMaximas () |
| SIGKILL every child Maxima we still have registered. | |
| static void | SetupTerminationHandlers () |
| Install the SIGTERM/SIGINT/SIGHUP handlers that run KillAllChildMaximas() so a child Maxima is not orphaned and left eating CPU/RAM if we are terminated by a signal instead of shutting down cleanly. | |
The Maxima process/socket lifecycle extracted from the wxMaxima god class.
Owned by value by the wxMaxima frame. Holds a reference back to that frame for the services the lifecycle handlers need.
|
static |
SIGKILL every child Maxima we still have registered.
Async-signal-safe (only kill() and reads of an array of sig_atomic_t) so it is safe to call from a signal handler or from wxWidgets' fatal-exception handler. No-op on Windows, where Maxima runs under maxima.bat and the taskkill-based cleanup applies instead.
|
static |
Install the SIGTERM/SIGINT/SIGHUP handlers that run KillAllChildMaximas() so a child Maxima is not orphaned and left eating CPU/RAM if we are terminated by a signal instead of shutting down cleanly.
No-op on Windows.
| bool MaximaProcessManager::StartMaxima | ( | bool | force = false | ) |
| bool MaximaProcessManager::WriteToMaximaStdin | ( | const wxString & | line | ) |
Writes one line of input to the Maxima process's stdin.
Used to talk to sbcl's low-level debugger (LDB), which reads its commands from stdin - not the control socket (LDB runs below the Lisp image and has no access to Maxima's socket stream). A trailing newline is appended if line does not already end in one. Returns false if there is no stdin stream (no process) or the write failed.