Bug 1580156 - set WebRTC thread name r=dmajor
authorNico Grunbaum <na-g@nostrum.com>
Thu, 07 Nov 2019 20:22:42 +0000
changeset 502010 0de59487070db211af91074884a00564363c8d85
parent 502009 776f4bc4d6113d1b6e301761f3c77fe33fb8df25
child 502011 3b42f1a5097a3ea23d91740ffd3bac899d128952
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1580156
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1580156 - set WebRTC thread name r=dmajor Differential Revision: https://phabricator.services.mozilla.com/D51975
media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
--- a/media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
+++ b/media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
@@ -69,28 +69,32 @@ bool IsThreadRefEqual(const PlatformThre
   return a == b;
 #elif defined(WEBRTC_POSIX)
   return pthread_equal(a, b);
 #endif
 }
 
 void SetCurrentThreadName(const char* name) {
 #if defined(WEBRTC_WIN)
+#pragma pack(push,8)
   struct {
     DWORD dwType;
     LPCSTR szName;
     DWORD dwThreadID;
     DWORD dwFlags;
   } threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
-
+#pragma pack(pop)
+#pragma warning(push)
+#pragma warning(disable: 6320 6322)
   __try {
-    ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
+    ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR),
                      reinterpret_cast<ULONG_PTR*>(&threadname_info));
   } __except (EXCEPTION_EXECUTE_HANDLER) {
   }
+#pragma warning(pop)
 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
   prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
 #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
   pthread_setname_np(name);
 #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
   pthread_set_name_np(pthread_self(), name);
 #elif defined(__NetBSD__) // WEBRTC_BSD
   pthread_setname_np(pthread_self(), "%s", (void*)name);