aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sciteco.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-05-09 19:08:32 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-05-09 19:08:32 +0200
commitf557af9a9112955d3b65f6ad0d54c0791189f961 (patch)
tree9d7718cb1571b624710a182f09aca7163dc673a0 /src/sciteco.h
parentbac1efa51bf889d494013925586e87ef08307529 (diff)
downloadsciteco-f557af9a9112955d3b65f6ad0d54c0791189f961.tar.gz
fixed CTRL+C interruptions on Windows; optimized CTRL+C polling on Gtk+
* teco_interrupt() turned out to be unsuitable to kill child processes (eg. when <EB> hangs). Instead, we have Win32-specific code now. * Since SIGINT can be ignored on UNIX, pressing CTRL+C was not guaranteed to kill the child process (eg. when <EB> hangs). At the same time, it makes sense to send SIGINT first, so programs can terminate gracefully. The behaviour has therefore been adapted: Interrupting with CTRL+C the first time will kill gracefully. The second time, a more agressive signal is sent to kill the child process. Unfortunately, this would be relatively tricky and complicated to do on Windows, so CTRL+C will always "hard-kill" the child process. * Moreover, teco_interrupt() killed the entire process on Windows when called the second time. This resulted in any interruption to terminate SciTECO unexpectedly when tried the second time on Gtk/Win32. * teco_sigint_occurred renamed to teco_interrupted: There may be several different sources for setting this flag. * Checking for CTRL+C on Gtk involves driving the main event loop repeatedly. This is a very expensive operation. We now do that only every 100ms. This is still sufficient since keyboard input comes from humans. This optimization saves 75% runtime on Windows and 90% on Linux. * The same optimization turned out to be contraproductive on PDCurses/WinGUI.
Diffstat (limited to 'src/sciteco.h')
-rw-r--r--src/sciteco.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/sciteco.h b/src/sciteco.h
index 4f3d88a..87bd973 100644
--- a/src/sciteco.h
+++ b/src/sciteco.h
@@ -85,10 +85,7 @@ enum {
extern teco_int_t teco_ed;
/* in main.c */
-extern volatile sig_atomic_t teco_sigint_occurred;
-
-/* in main.c */
-void teco_interrupt(void);
+extern volatile sig_atomic_t teco_interrupted;
/*
* Allows automatic cleanup of FILE pointers.