juce_win32_threads.cpp: juce_setThreadPriority() -> bool


#1

This helper function is bool in juce_Thread.cpp but void in juce_win32_threads.cpp, causing a linker error in my app.

Seems a simple matter to fix:

The win32 SDK says:

BOOL WINAPI SetThreadPriority(HANDLE hThread, int nPriority);

Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

so the fix seems trivial:

bool /*not void*/ juce_setThreadPriority (void* threadHandle, int priority) throw() { ... return SetThreadPriority (threadHandle, pri); }


#2

That’s already done in my code (?)… maybe I missed out that file when I was checking stuff in - I’ll double-check.


#3

Thanks - newly checked-in v. 741 corrects the problem.


#4

The correction results in a warning in Visual Studio 2008:

According to the documentation, I corrected the line adding " != 0"

return SetThreadPriority (threadHandle, pri) != 0;

…and the warning disappears.


#5

Thanks, I think I already tidied that one up.