Use a thread status flag to indicate interrupt status instead of trying to raise from the signal handler
This commit is contained in:
parent
37353c2b88
commit
88c6d27569
@ -522,7 +522,7 @@ _dbgQuit:
|
||||
|
||||
static void handleSigint(int sigNum) {
|
||||
if (krk_currentThread.frameCount) {
|
||||
krk_runtimeError(vm.exceptions->keyboardInterrupt, "Keyboard interrupt.");
|
||||
krk_currentThread.flags |= KRK_THREAD_SIGNALLED;
|
||||
}
|
||||
|
||||
signal(sigNum, handleSigint);
|
||||
|
5
src/vm.c
5
src/vm.c
@ -1800,6 +1800,11 @@ static KrkValue run() {
|
||||
if (krk_currentThread.flags & KRK_THREAD_SINGLE_STEP) {
|
||||
krk_debuggerHook(frame);
|
||||
}
|
||||
|
||||
if (krk_currentThread.flags & KRK_THREAD_SIGNALLED) {
|
||||
krk_runtimeError(vm.exceptions->keyboardInterrupt, "Keyboard interrupt.");
|
||||
goto _finishException;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
|
Loading…
Reference in New Issue
Block a user