From be213a402b581be3a05e251de327c45d056c6216 Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Mon, 8 Feb 2016 21:35:08 +1300 Subject: [PATCH 1/3] fix building with glibc < 2.12 --- include/bx/thread.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/bx/thread.h b/include/bx/thread.h index fb9e07d..0bdc5c4 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -8,6 +8,9 @@ #if BX_PLATFORM_POSIX # include + #if !((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12))) + #include + #endif #elif BX_PLATFORM_WINRT using namespace Platform; using namespace Windows::Foundation; @@ -150,7 +153,11 @@ namespace bx #if BX_PLATFORM_OSX || BX_PLATFORM_IOS pthread_setname_np(_name); #elif (BX_PLATFORM_LINUX && defined(__GLIBC__)) || BX_PLATFORM_BSD + #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)) pthread_setname_np(m_handle, _name); + #else + prctl(PR_SET_NAME,_name,0,0,0); + #endif #elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC # pragma pack(push, 8) struct ThreadName From e28fd196018c61b746db07919697ed5df01eb6f6 Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Mon, 8 Feb 2016 23:13:47 +1300 Subject: [PATCH 2/3] correct for non-glibc systems --- include/bx/thread.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bx/thread.h b/include/bx/thread.h index 0bdc5c4..71185bb 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -8,8 +8,10 @@ #if BX_PLATFORM_POSIX # include - #if !((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12))) - #include + #if defined(__GLIBC__) + #if!((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12))) + #include + #endif #endif #elif BX_PLATFORM_WINRT using namespace Platform; From 3cd02350c834d7330f6a936b5f47a9573c4e3bcb Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Tue, 9 Feb 2016 00:10:48 +1300 Subject: [PATCH 3/3] correction for BSD --- include/bx/thread.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/bx/thread.h b/include/bx/thread.h index 71185bb..0abccaa 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -154,12 +154,14 @@ namespace bx { #if BX_PLATFORM_OSX || BX_PLATFORM_IOS pthread_setname_np(_name); -#elif (BX_PLATFORM_LINUX && defined(__GLIBC__)) || BX_PLATFORM_BSD +#elif (BX_PLATFORM_LINUX && defined(__GLIBC__)) #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)) pthread_setname_np(m_handle, _name); #else prctl(PR_SET_NAME,_name,0,0,0); #endif +#elif BX_PLATFORM_BSD + pthread_setname_np(m_handle, _name); #elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC # pragma pack(push, 8) struct ThreadName