diff main/main.cpp @ 2342:175ece418988

Merge from branch time-frequency-boxes
author Chris Cannam
date Mon, 07 Oct 2019 09:36:11 +0100
parents 3dacb1001537
children 7bed1c28b5e9
line wrap: on
line diff
--- a/main/main.cpp	Mon Oct 07 09:32:50 2019 +0100
+++ b/main/main.cpp	Mon Oct 07 09:36:11 2019 +0100
@@ -188,12 +188,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();
+    
     exit(0);
 }