Mercurial > hg > sonic-visualiser
diff main/main.cpp @ 2338:3dacb1001537 time-frequency-boxes
Don't wait forever for this lock
author | Chris Cannam |
---|---|
date | Fri, 04 Oct 2019 16:04:55 +0100 |
parents | a1c14880404b |
children | 7bed1c28b5e9 |
line wrap: on
line diff
--- 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); }