In file included from ../source/modules/juce_core/juce_core.cpp:178:0:
../source/modules/juce_core/native/juce_posix_SharedCode.h: In static member function 'static void juce::Thread::setCurrentThreadName(const juce::String&)':
../source/modules/juce_core/native/juce_posix_SharedCode.h:878:57: error: 'pthread_setname_np' was not declared in this scope
This is Ubuntu 10.04, using gcc-4.6.
The build was fine ~2 months ago on the same system…
has something changed in the thread code?
If pthread_setname_np is not available, you can crib this function. Not sure under what conditions it is appropriate, though (although it seems to be Linux specific).
You should definitely use pthread_setname_np but if that is unavailable for the platform, the prctl should be used as a fallback. If someone isn’t seeing the thread name, they likely either have a permission problem with their account or they forgot the proper flag in the ps command.
np stands for “non portable”.
It’s not in the Posix standard. Yet, it’s supported with any decent (recent) GLibC on both MacOSX and Linux.
Older linux does not provide it, and the pctrl works on them because on those system a thread is a process (pctrl means process control).
So I think Vincent is right, if you intend to support older system, you need to provide a fallback, that, someday in the future, you’ll deprecate and remove.