util: Fix terminate_processing() called from non-main thread

The current raise(SIGTERM) sends a signal to the calling thread. If
terminate_processing() is called from a non-main thread and that thread
was created at InitPostScript() time when SIGTERM is blocked, or has
blocked SIGTERM manually, terminate_processing() has no effect.

Switching to kill(getpid(), SIGTERM) guarantees that a thread that doesn't
block the signal (minimally the main thread) will run the handler.
This commit is contained in:
Arne Welzel 2025-03-08 20:35:30 +01:00
parent 574514b04c
commit 679575d6b2

View file

@ -830,7 +830,7 @@ double calc_next_rotate(double current, double interval, double base) {
void terminate_processing() { void terminate_processing() {
if ( ! run_state::terminating ) if ( ! run_state::terminating )
raise(SIGTERM); kill(getpid(), SIGTERM);
} }
void set_processing_status(const char* status, const char* reason) { void set_processing_status(const char* status, const char* reason) {