mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-01 12:24:24 +00:00
It's dangerous coding on Mondays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -114,8 +114,8 @@ void sys::PrintStackTraceOnErrorSignal() {
|
|||||||
|
|
||||||
|
|
||||||
void sys::SetInterruptFunction(void (*IF)()) {
|
void sys::SetInterruptFunction(void (*IF)()) {
|
||||||
InterruptFunction = IF;
|
|
||||||
RegisterHandler();
|
RegisterHandler();
|
||||||
|
InterruptFunction = IF;
|
||||||
LeaveCriticalSection(&CriticalSection);
|
LeaveCriticalSection(&CriticalSection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,6 +239,7 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
|
static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
|
||||||
|
// We are running in our very own thread, courtesy of Windows.
|
||||||
EnterCriticalSection(&CriticalSection);
|
EnterCriticalSection(&CriticalSection);
|
||||||
Cleanup();
|
Cleanup();
|
||||||
|
|
||||||
@ -248,13 +249,9 @@ static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
|
|||||||
InterruptFunction = 0; // Don't run it on another CTRL-C.
|
InterruptFunction = 0; // Don't run it on another CTRL-C.
|
||||||
|
|
||||||
if (IF) {
|
if (IF) {
|
||||||
try {
|
// Note: if the interrupt function throws an exception, there is nothing
|
||||||
|
// to catch it in this thread so it will kill the process.
|
||||||
IF(); // Run it now.
|
IF(); // Run it now.
|
||||||
} catch (...) {
|
|
||||||
// Kill the process on an exception.
|
|
||||||
LeaveCriticalSection(&CriticalSection);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
LeaveCriticalSection(&CriticalSection);
|
LeaveCriticalSection(&CriticalSection);
|
||||||
return TRUE; // Don't kill the process.
|
return TRUE; // Don't kill the process.
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user