mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Fix SetCurrentThreadName() for Fuchsia.
CL suggested by lingxueluo@. Bug: b/236891952 Change-Id: I960d5b016186e9784e0af5e86608891a06e78b7e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284920 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38723}
This commit is contained in:
parent
6e55319b5d
commit
d409621f28
2 changed files with 15 additions and 1 deletions
|
@ -314,7 +314,10 @@ rtc_library("platform_thread_types") {
|
|||
"platform_thread_types.cc",
|
||||
"platform_thread_types.h",
|
||||
]
|
||||
deps = [ ":macromagic" ]
|
||||
deps = [
|
||||
":checks",
|
||||
":macromagic",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("refcount") {
|
||||
|
|
|
@ -25,6 +25,13 @@ typedef HRESULT(WINAPI* RTC_SetThreadDescription)(HANDLE hThread,
|
|||
PCWSTR lpThreadDescription);
|
||||
#endif
|
||||
|
||||
#if defined(WEBRTC_FUCHSIA)
|
||||
#include <string.h>
|
||||
#include <zircon/syscalls.h>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#endif
|
||||
|
||||
namespace rtc {
|
||||
|
||||
PlatformThreadId CurrentThreadId() {
|
||||
|
@ -109,6 +116,10 @@ void SetCurrentThreadName(const char* name) {
|
|||
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
|
||||
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||
pthread_setname_np(name);
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME,
|
||||
name, strlen(name));
|
||||
RTC_DCHECK_EQ(status, ZX_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue