diff main/main.cpp @ 609:ef0778016c88

Version and beta warning
author Chris Cannam
date Wed, 09 Oct 2019 14:58:10 +0100
parents e50b2e568679
children e06cbdc7301c
line wrap: on
line diff
--- a/main/main.cpp	Wed Oct 09 14:02:01 2019 +0100
+++ b/main/main.cpp	Wed Oct 09 14:58:10 2019 +0100
@@ -55,13 +55,15 @@
     // Avoid this happening more than once across threads
 
     cerr << "signalHandler: cleaning up and exiting" << endl;
-    cleanupMutex.lock();
-    if (!cleanedUp) {
-        TempDirectory::getInstance()->cleanup();
-        cleanedUp = true;
+
+    if (cleanupMutex.tryLock(5000)) {
+        if (!cleanedUp) {
+            TempDirectory::getInstance()->cleanup();
+            cleanedUp = true;
+        }
+        cleanupMutex.unlock();
     }
-    cleanupMutex.unlock();
-    cerr << "signalHandler: cleaned up" << endl;
+    
     exit(0);
 }