diff options
-rw-r--r-- | include/llvm/System/Signals.h | 4 | ||||
-rw-r--r-- | lib/System/Unix/Signals.inc | 4 | ||||
-rw-r--r-- | lib/System/Win32/Signals.inc | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/System/Signals.h b/include/llvm/System/Signals.h index 2b9d8ca..504420c 100644 --- a/include/llvm/System/Signals.h +++ b/include/llvm/System/Signals.h @@ -20,6 +20,10 @@ namespace llvm { namespace sys { + /// This function runs all the registered interrupt handlers, including the + /// removal of files registered by RemoveFileOnSignal. + void RunInterruptHandlers(); + /// This function registers signal handlers to ensure that if a signal gets /// delivered that the named file is removed. /// @brief Remove a file if a fatal signal occurs. diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc index 56bf9e7..9548816 100644 --- a/lib/System/Unix/Signals.inc +++ b/lib/System/Unix/Signals.inc @@ -152,7 +152,9 @@ static RETSIGTYPE SignalHandler(int Sig) { CallBacksToRun[i].first(CallBacksToRun[i].second); } - +void llvm::sys::RunInterruptHandlers() { + SignalHandler(SIGINT); +} void llvm::sys::SetInterruptFunction(void (*IF)()) { SignalsMutex.acquire(); diff --git a/lib/System/Win32/Signals.inc b/lib/System/Win32/Signals.inc index f2b72ca..a3a393c 100644 --- a/lib/System/Win32/Signals.inc +++ b/lib/System/Win32/Signals.inc @@ -189,6 +189,10 @@ static void Cleanup() { LeaveCriticalSection(&CriticalSection); } +void llvm::sys::RunInterruptHandlers() { + Cleanup(); +} + static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) { try { Cleanup(); |