Windows: Fixed sys::findProgramByName to work with files containing dot in their...
[oota-llvm.git] / lib / Support / Signals.cpp
index a11789372d935d38ac26af1df38f4a11f48f6ada..2c3560c3be90619c3642366c3a3079504c1936df 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/Signals.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Signals.h"
+
+#include <vector>
 
 namespace llvm {
 using namespace sys;
@@ -23,6 +26,15 @@ using namespace sys;
 //===          independent code.
 //===----------------------------------------------------------------------===//
 
+static ManagedStatic<std::vector<std::pair<void (*)(void *), void *>>>
+    CallBacksToRun;
+void sys::RunSignalHandlers() {
+  if (!CallBacksToRun.isConstructed())
+    return;
+  for (auto &I : *CallBacksToRun)
+    I.first(I.second);
+  CallBacksToRun->clear();
+}
 }
 
 // Include the platform-specific parts of this class.