Fix number of arguments being passed when setting the thread name on Windows.
BUG=webrtc:11079 Change-Id: Ib12d4b252cb9b4dbe52320ae97e9c926e6d004ae Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159035 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29739}
This commit is contained in:
parent
ad780a36c2
commit
7d5fe67b83
@ -58,18 +58,25 @@ bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) {
|
|||||||
|
|
||||||
void SetCurrentThreadName(const char* name) {
|
void SetCurrentThreadName(const char* name) {
|
||||||
#if defined(WEBRTC_WIN)
|
#if defined(WEBRTC_WIN)
|
||||||
|
// For details see:
|
||||||
|
// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
|
||||||
|
#pragma pack(push, 8)
|
||||||
struct {
|
struct {
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
LPCSTR szName;
|
LPCSTR szName;
|
||||||
DWORD dwThreadID;
|
DWORD dwThreadID;
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
} threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
|
} threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 6320 6322)
|
||||||
__try {
|
__try {
|
||||||
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
|
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR),
|
||||||
reinterpret_cast<ULONG_PTR*>(&threadname_info));
|
reinterpret_cast<ULONG_PTR*>(&threadname_info));
|
||||||
} __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT
|
} __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT
|
||||||
}
|
}
|
||||||
|
#pragma warning(pop)
|
||||||
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
|
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
|
||||||
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
||||||
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user