| 269 | } |
| 270 | |
| 271 | VideoCache::~VideoCache() |
| 272 | { |
| 273 | DEBUG_CACHING("VideoCache::~VideoCache Terminate all workers and threads"); |
| 274 | |
| 275 | // Tell all threads to quit |
| 276 | for (loadingThread *t : cachingThreadList) |
| 277 | t->quitWhenDone(); |
| 278 | interactiveThread[0]->quitWhenDone(); |
| 279 | interactiveThread[1]->quitWhenDone(); |
| 280 | |
| 281 | // Wait for the threads to quit, otherwise terminate them |
| 282 | for (int i = 0; i < 2; i++) |
| 283 | if (!interactiveThread[i]->wait(3000)) |
| 284 | { |
| 285 | interactiveThread[i]->terminate(); |
| 286 | interactiveThread[i]->wait(); |
| 287 | } |
| 288 | for (loadingThread *t : cachingThreadList) |
| 289 | if (!t->wait(3000)) |
| 290 | { |
| 291 | t->terminate(); |
| 292 | t->wait(); |
| 293 | } |
| 294 | |
| 295 | // Delete all threads |
| 296 | for (loadingThread *t : cachingThreadList) |
| 297 | t->deleteLater(); |
| 298 | } |
| 299 | |
| 300 | void VideoCache::startWorkerThreads(int nrThreads) |
| 301 | { |
nothing calls this directly
no test coverage detected