Prevent Cleanup() from running more than once.
[oota-llvm.git] / lib / Support / Windows / Signals.inc
index d81d3c8b90bb14cdb09a5db75eca60fbb144c70b..26c3c6e111ab55039100760c2a3a71d84a55d70e 100644 (file)
@@ -441,6 +441,9 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
 }
 
 static void Cleanup() {
+  if (CleanupExecuted)
+    return;
+
   EnterCriticalSection(&CriticalSection);
 
   // Prevent other thread from registering new files and directories for