From de9bcd0fae113eb707c5c06c424ef38400780981 Mon Sep 17 00:00:00 2001 From: xingqiao Date: Thu, 28 Mar 2024 15:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8apphi=E4=B8=8B?= =?UTF-8?q?=E7=9A=84pthread=5Fgetname=5Fnp=20=E5=87=BD=E6=95=B0=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98=20=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9musl=20libc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Util/util.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Util/util.cpp b/src/Util/util.cpp index e63b9c92..5ef277c5 100644 --- a/src/Util/util.cpp +++ b/src/Util/util.cpp @@ -505,7 +505,9 @@ string getThreadName() { string ret; ret.resize(32); auto tid = pthread_self(); - pthread_getname_np(tid, (char *) ret.data(), ret.size()); +#if defined(__GLIBC__) + pthread_getname_np(tid, (char*)ret.data(), ret.size()); +#endif if (ret[0]) { ret.resize(strlen(ret.data())); return ret;