# HG changeset patch
# User Chris Cannam
# Date 1570201495 -3600
# Node ID 3dacb1001537468300a095f21342c0479d3b6f34
# Parent  2721030c939fcce21b5977b0cf9f3424501330bf
Don't wait forever for this lock

diff -r 2721030c939f -r 3dacb1001537 main/main.cpp
--- a/main/main.cpp	Wed Sep 25 11:13:16 2019 +0100
+++ b/main/main.cpp	Fri Oct 04 16:04:55 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);
 }