From 484fff444f3cc2f13afce8a1274ef61be5c02155 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 31 Aug 2012 05:23:20 +0200 Subject: [PATCH] Compile fix for OSX --- indra/cwdebug/debug.cc | 4 ---- indra/llcommon/aithreadid.cpp | 2 ++ indra/llcommon/aithreadid.h | 16 +++++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/indra/cwdebug/debug.cc b/indra/cwdebug/debug.cc index cad6da46d..06723f8ae 100644 --- a/indra/cwdebug/debug.cc +++ b/indra/cwdebug/debug.cc @@ -447,11 +447,7 @@ std::ostream& operator<<(std::ostream& os, print_thread_id_t) { if (!AIThreadID::in_main_thread_inline()) { -#ifdef LL_DARWIN - os << std::hex << (size_t)apr_os_thread_current() << std::dec << ' '; -#else os << std::hex << (size_t)AIThreadID::getCurrentThread_inline() << std::dec << ' '; -#endif } return os; } diff --git a/indra/llcommon/aithreadid.cpp b/indra/llcommon/aithreadid.cpp index 64a8dd21a..e8dd17097 100644 --- a/indra/llcommon/aithreadid.cpp +++ b/indra/llcommon/aithreadid.cpp @@ -50,6 +50,7 @@ void AIThreadID::set_current_thread_id(void) #endif } +#ifndef LL_DARWIN void AIThreadID::reset(void) { mID = lCurrentThread; @@ -69,6 +70,7 @@ apr_os_thread_t AIThreadID::getCurrentThread(void) { return lCurrentThread; } +#endif std::ostream& operator<<(std::ostream& os, AIThreadID const& id) { diff --git a/indra/llcommon/aithreadid.h b/indra/llcommon/aithreadid.h index 2bb3f1dac..3b3b1500c 100644 --- a/indra/llcommon/aithreadid.h +++ b/indra/llcommon/aithreadid.h @@ -62,11 +62,7 @@ public: friend LL_COMMON_API std::ostream& operator<<(std::ostream& os, AIThreadID const& id); static void set_main_thread_id(void); // Called once to set sMainThreadID. static void set_current_thread_id(void); // Called once for every thread to set lCurrentThread. -#ifdef LL_DARWIN - void reset(void) { mID = apr_os_thread_current(); } - bool equals_current_thread(void) const { return apr_os_thread_equal(mID, apr_os_thread_current()); } - static bool in_main_thread(void) { return apr_os_thread_equal(apr_os_thread_current(), sMainThreadID); } -#else +#ifndef LL_DARWIN LL_COMMON_API void reset(void); LL_COMMON_API bool equals_current_thread(void) const; LL_COMMON_API static bool in_main_thread(void); @@ -76,6 +72,16 @@ public: bool equals_current_thread_inline(void) const { return apr_os_thread_equal(mID, lCurrentThread); } static bool in_main_thread_inline(void) { return apr_os_thread_equal(lCurrentThread, sMainThreadID); } static apr_os_thread_t getCurrentThread_inline(void) { return lCurrentThread; } +#else + // Both variants are inline on OS X. + void reset(void) { mID = apr_os_thread_current(); } + void reset_inline(void) { mID = apr_os_thread_current(); } + bool equals_current_thread(void) const { return apr_os_thread_equal(mID, apr_os_thread_current()); } + bool equals_current_thread_inline(void) const { return apr_os_thread_equal(mID, apr_os_thread_current()); } + static bool in_main_thread(void) { return apr_os_thread_equal(apr_os_thread_current(), sMainThreadID); } + static bool in_main_thread_inline(void) { return apr_os_thread_equal(apr_os_thread_current(), sMainThreadID); } + static apr_os_thread_t getCurrentThread(void) { return apr_os_thread_current(); } + static apr_os_thread_t getCurrentThread_inline(void) { return apr_os_thread_current(); } #endif };