How to go about multithreading with "priority"? <p>I have multiple threads processing multiple files in the background, while the program is idle.<br> To improve disk throughput, I use critical sections to ensure that no two threads ever use the same <em>disk</em> simultaneously.</p> <p>The (pseudo-)code looks something like this:</p> <pre><code>void RunThread(HANDLE fileHandle) { // Acquire CRITICAL_SECTION for disk CritSecLock diskLock(GetDiskLock(fileHandle)); for (...) { // Do some processing on file } } </code></pre> <p>Once the user requests a file to be processed, I need to <em>stop all threads</em> -- <em>except</em> the one which is processing the requested file. Once the file is processed, then I'd like to resume all the threads again.</p> <p>Given the fact that <code>SuspendThread</code> is a bad idea, how do I go about stopping all threads except the one that is processing the relevant input?</p> <p>What kind of threading objects/features would I need -- mutexes, semaphores, events, or something else? And how would I use them? (I'm hoping for compatibility with Windows XP.)</p>