Does SetThreadPriority cause thread reschedulling?
- by Suma
Consider following situation, assuming single CPU system:
thread A is running with a priority THREAD_PRIORITY_NORMAL, signals event E
thread B with a priority THREAD_PRIORITY_LOWEST is waiting for an event E (Note: at this point the thread is not scheduled because it is runnable, but A is higher priority and runnable as well)
thread A calls SetThreadPriority(B, THREAD_PRIORITY_ABOVE_NORMAL)
Is thread B re-scheduled immediately to run, or is thread A allowed to continue until current time-slice is over, and B is scheduled only once a new time-slice has begun?
I would be interested to know the answer for WinXP, Vista and Win7, if possible.
Note: the scenario above is simplified from my real world code, where multiple threads are running on multiple cores, but the main object of the question stays: does SetThreadPriority cause thread scheduling to happen?