Windows utility to setTheadName to help debugging.
R=juberti@google.com, mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/49919004 Cr-Commit-Position: refs/heads/master@{#9182}
This commit is contained in:
@@ -453,4 +453,19 @@ bool GetCurrentProcessIntegrityLevel(int* level) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SetCurrentThreadName(const char* name) {
|
||||
struct {
|
||||
DWORD dwType;
|
||||
LPCSTR szName;
|
||||
DWORD dwThreadID;
|
||||
DWORD dwFlags;
|
||||
} threadname_info = {0x100, name, static_cast<DWORD>(-1), 0};
|
||||
|
||||
__try {
|
||||
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
|
||||
reinterpret_cast<ULONG_PTR*>(&threadname_info));
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
}
|
||||
} // namespace rtc
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace rtc {
|
||||
const char* win32_inet_ntop(int af, const void *src, char* dst, socklen_t size);
|
||||
int win32_inet_pton(int af, const char* src, void *dst);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline std::wstring ToUtf16(const char* utf8, size_t len) {
|
||||
int len16 = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(len),
|
||||
NULL, 0);
|
||||
@@ -128,7 +126,8 @@ inline bool IsCurrentProcessLowIntegrity() {
|
||||
|
||||
bool AdjustCurrentProcessPrivilege(const TCHAR* privilege, bool to_enable);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Sets the current thread name for the windows debugger.
|
||||
void SetCurrentThreadName(const char* name);
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user