setCurrentThreadName() for Release builds


I believe juce::Thread::setCurrentThreadName() should read like this:

void Thread::setCurrentThreadName (const String& name)
    if (juce_isRunningUnderDebugger ())
          DWORD dwType;
          LPCSTR szName;
          DWORD dwThreadID;
          DWORD dwFlags;
      } info;

      info.dwType = 0x1000;
      info.szName = name.toUTF8();
      info.dwThreadID = GetCurrentThreadId();
      info.dwFlags = 0;

          RaiseException (0x406d1388 /*MS_VC_EXCEPTION*/, 0, sizeof (info) / sizeof (ULONG_PTR), (ULONG_PTR*) &info);
    (void) name;

This way we can see thread names when running release builds under the debugger.


I don’t really agree… In a release build, I don’t want my threads to have names, and I’d have thought that in general, most people will want their releases to be as obfuscated as possible?


If you want obfuscated thread names that can be done at the point of construction in the client code instead of in setCurrentThreadName. A function should do what it says.

The problem is that the debug version of my app is too slow for debugging the audio callback, it drops out and what not. I need to run release, with a debugger attached. I can use my own copy of the function I guess, but I would imagine that since Juce is used a lot for audio applications, other users would be in my situation as well (running a Release build with symbols and a debugger).