comparison 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
comparison
equal deleted inserted replaced
2333:2721030c939f 2338:3dacb1001537
186 signalHandler(int /* signal */) 186 signalHandler(int /* signal */)
187 { 187 {
188 // Avoid this happening more than once across threads 188 // Avoid this happening more than once across threads
189 189
190 cerr << "signalHandler: cleaning up and exiting" << endl; 190 cerr << "signalHandler: cleaning up and exiting" << endl;
191 cleanupMutex.lock(); 191
192 if (!cleanedUp) { 192 if (cleanupMutex.tryLock(5000)) {
193 TempDirectory::getInstance()->cleanup(); 193 if (!cleanedUp) {
194 cleanedUp = true; 194 TempDirectory::getInstance()->cleanup();
195 } 195 cleanedUp = true;
196 cleanupMutex.unlock(); 196 }
197 cleanupMutex.unlock();
198 }
199
197 exit(0); 200 exit(0);
198 } 201 }
199 202
200 class SVApplication : public QApplication 203 class SVApplication : public QApplication
201 { 204 {