Useful : setCurrentThreadDebugName()


here is a useful piece of code if you are working on a multithreaded application on visual studio (tested on vc 6 and 7.1), you can see quickly where are the threads you are interrested in :

[code]#define MS_VC_EXCEPTION 0x406d1388

// The name is limited to 9 character
void juce_setCurrentThreadDebugName (void* handle, const String& name)
DWORD dwType; // must be 0x1000
LPCSTR szName; // pointer to name (in same addr space) - 9 chars max
DWORD dwThreadID; // thread ID (-1 caller thread)
DWORD dwFlags; // reserved for future use, most be zero
} info;

info.dwType = 0x1000;
  info.szName = (const char* )name;
  info.dwThreadID = GetCurrentThreadId();// fixme: this must be called by current thread
  info.dwFlags = 0;

    RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (DWORD *)&info);


I don’t know if it exists for other debuggers, but it would be nice to include it in juce.

Also to add it in juce’s threads like MIDI, DSound, Audio,