From 61d9232c0245af1030213c4ea608318b13ca3118 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 17 Jun 2016 15:43:18 +0300 Subject: [PATCH] [core] Do not use pthread_getname_np before glibc 2.11 Follows approach in src/mbgl/util/thread.hpp header. --- src/mbgl/platform/log.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mbgl/platform/log.cpp b/src/mbgl/platform/log.cpp index 4b56435df..648c3bd18 100644 --- a/src/mbgl/platform/log.cpp +++ b/src/mbgl/platform/log.cpp @@ -49,11 +49,17 @@ void Log::record(EventSeverity severity, Event event, int64_t code, const std::s std::stringstream logStream; - #if !defined(__ANDROID__) && (defined( __APPLE__) || defined(__linux__)) +#if defined(__APPLE__) char name[32]; pthread_getname_np(pthread_self(), name, sizeof(name)); logStream << "{" << name << "}"; - #endif +#elif defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 12) + char name[32]; + pthread_getname_np(pthread_self(), name, sizeof(name)); + logStream << "{" << name << "}"; +#endif +#endif logStream << "[" << Enum::toString(event) << "]";