BR: Thread::setPriority() on Windows

Hi,

The Windows implementation of Thread::setPriority() currently does this:

return setPriorityInternal (isRealtime(), this, priority);

But the helper passes the second argument straight to Windows SetThreadPriority(), which expects a thread handle, not a juce::Thread object.

I tested background, low and normal from inside a JUCE thread’s run() method, and all three return false with ERROR_INVALID_HANDLE, leaving the native priority unchanged.

As a workaround I’m calling SetThreadPriority() directly with GetCurrentThread() which works as expected. Replacing this with threadHandle at juce_Threads_windows.cpp:128 seems to fix the problem.

Thanks!

Thank you for reporting.

Fixed here:

Thanks @t0m !

Are there any plans to support priority levels for non-realtime threads on Linux as well?