Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanup
authorDaniel Dunbar <daniel@zuster.org>
Sat, 8 May 2010 02:10:34 +0000 (02:10 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 8 May 2010 02:10:34 +0000 (02:10 +0000)
stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103333 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/System/Signals.h
lib/System/Unix/Signals.inc
lib/System/Win32/Signals.inc

index 2b9d8ca6bf92196929757d5d763c62950519c02a..504420cd402dd5a49d9568fa84d1cdad3b2fbd7f 100644 (file)
 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.
index 56bf9e76e60a251a772c0fc49222e634e14430bb..9548816e1d4131e796232e27f28b792e5a60d84b 100644 (file)
@@ -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();
index f2b72ca70fdd70ce78932261bae234cdeaa2dca6..a3a393c76e456c0021888e2cbc0d6d1dd07b3051 100644 (file)
@@ -189,6 +189,10 @@ static void Cleanup() {
   LeaveCriticalSection(&CriticalSection);
 }
 
+void llvm::sys::RunInterruptHandlers() {
+  Cleanup();
+}
+
 static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
   try {
     Cleanup();