In the message thread, I tried to change priority of a background worker thread to 0, which is not running.
Thread::setPriority() calls Thread::setThreadPriority() with nullptr as a handle.
https://github.com/julianstorer/JUCE/blob/633ff931d6147daa67398bbf2055449b81c9899d/modules/juce_core/threads/juce_Thread.cpp#L224
It leads setThreadPriority() to change the current thread's priority.
https://github.com/julianstorer/JUCE/blob/633ff931d6147daa67398bbf2055449b81c9899d/modules/juce_core/native/juce_posix_SharedCode.h#L906
https://github.com/julianstorer/JUCE/blob/633ff931d6147daa67398bbf2055449b81c9899d/modules/juce_core/native/juce_win32_Threads.cpp#L178
Thus the message thread's priority is changed to 0, unexpectedly.
I tried fixing this:
if (setThreadPriority (threadHandle, newPriority))
{
threadPriority = newPriority;
return true;
}
return false;
as follows:
if (isThreadRunning())
{
if (!setThreadPriority (threadHandle, newPriority))
{
return false;
}
}
threadPriority = newPriority;
return true;
and it got working as expected.
