Commit Graph

9 Commits

Author SHA1 Message Date
a291771153 Now using a separate QSemaphore to limit the number of tasks in the queue of the QThreadPool. Instead of starting exactly as many task as there are threads in the pool and adding a new task only after a running one finished, we will now keep a fixed number of tasks in the queue (currently hardcoded to 32). Since there always will be more tasks left in the queue than there are threads in the pool, we ensure that no thread will ever become idle. Might be slightly faster than the "old" approach. 2012-05-25 02:24:44 +02:00
c18785ce1e Changed the method to synchronize the analyzer threads: We now use QSet to maintain a list of the thread id's of all threads that are still running - instead of only recording the highest thread id that has finished. This way a thread can now actually check if there still is any running thread with a lower thread id. Before thread n could only check if thread n-1 has finished yet or not. As a result we can relax the waiting now. Only threads that want to emit a file will wait for the "previous" threads to finish. 2012-05-14 00:50:16 +02:00
193488e26f Fix: In order to ensure the "correct" ordering, *all* threads need to wait for the previous threads to finish - not only the threads that will emit a file. If both, thread n and n+1, want to emit a file and thus n+1 has to wait for n, we additionally must allow thread n+2 to terminate before n and n+1, even if n+2 does *not* emit a file. That's because as soon as n+2 finishes, it unblocks all threads x with x < n+2, which includes n and n+1. If that happens and n+1 is still waiting for n, we effectively allow n+1 to emit its file *before* n. By blocking all threads x with x > n+1 until n+1 has finished (regardless of whether they want to emit a file or not) this problem is resolved. As long as we assume that most threads actually *do* emit a file, this commit shouldn't hurt the performance. 2012-05-12 02:51:24 +02:00
9175daae0d Some code refactoring regarding the QWaitCondition/QMutex in FileAnalyzer_Task. 2012-05-09 02:54:41 +02:00
814b725fe3 Slightly improved progress indicator for file analyzer: Additional files from playlists are now taken into account earlier. 2012-05-08 01:12:26 +02:00
e13b93f51b Implemented progress indicator for the working banner. 2012-05-06 04:57:00 +02:00
a7a776ed82 Implemented a method to disables update signals from the FileList model. This will significantly speed-up adding a lot files, but comes with the drawback that updates won't be visible immediately. 2012-05-05 21:56:14 +02:00
160b997c76 Now using a QWaitCondition to synchronize the FileAnalyzer threads. 2012-05-05 03:55:27 +02:00
14492b9c49 Implemented multi-threading for file analyzer. Now multiple files can be analyzed in parallel. This should speed-up adding files quite a bit, especially when a huge number of files is added at once. 2012-05-04 04:01:10 +02:00