Linux build pass.

This commit is contained in:
Shyotl
2014-12-08 18:46:15 -06:00
parent 18e33d2268
commit ab4561aacc
2 changed files with 32 additions and 8 deletions

View File

@@ -27,12 +27,14 @@
#ifndef LL_LLTHREAD_H #ifndef LL_LLTHREAD_H
#define LL_LLTHREAD_H #define LL_LLTHREAD_H
#define USE_BOOST_MUTEX #define USE_BOOST_MUTEX 0
#define IS_LLCOMMON_INLINE (!LL_COMMON_LINK_SHARED || defined(llcommon_EXPORTS))
#if LL_GNUC #if LL_GNUC
// Needed for is_main_thread() when compiling with optimization (relwithdebinfo). // Needed for is_main_thread() when compiling with optimization (relwithdebinfo).
// It doesn't hurt to just always specify it though. // It doesn't hurt to just always specify it though.
#pragma interface //#pragma interface
#endif #endif
#include "llapp.h" #include "llapp.h"
@@ -188,7 +190,7 @@ protected:
//Prefer boost over stl over windows over apr. //Prefer boost over stl over windows over apr.
#if defined(USE_BOOST_MUTEX) && (BOOST_VERSION >= 103400) //condition_variable_any was added in boost 1.34 #if USE_BOOST_MUTEX && (BOOST_VERSION >= 103400) //condition_variable_any was added in boost 1.34
//Define BOOST_SYSTEM_NO_DEPRECATED to avoid system_category() and generic_category() dependencies, as those won't be exported. //Define BOOST_SYSTEM_NO_DEPRECATED to avoid system_category() and generic_category() dependencies, as those won't be exported.
#define BOOST_SYSTEM_NO_DEPRECATED #define BOOST_SYSTEM_NO_DEPRECATED
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
@@ -268,7 +270,12 @@ public:
{ {
if (inc_lock_if_recursive()) if (inc_lock_if_recursive())
return; return;
#if IS_LLCOMMON_INLINE
if (AIThreadID::in_main_thread_inline() && LLApp::isRunning()) if (AIThreadID::in_main_thread_inline() && LLApp::isRunning())
#else
if (AIThreadID::in_main_thread() && LLApp::isRunning())
#endif
{ {
if (!LLMutexImpl::try_lock()) if (!LLMutexImpl::try_lock())
{ {
@@ -279,7 +286,11 @@ public:
{ {
LLMutexImpl::lock(); LLMutexImpl::lock();
} }
#if IS_LLCOMMON_INLINE
mLockingThread.reset_inline(); mLockingThread.reset_inline();
#else
mLockingThread.reset();
#endif
} }
void unlock() void unlock()
@@ -302,7 +313,11 @@ public:
return true; return true;
if (!LLMutexImpl::try_lock()) if (!LLMutexImpl::try_lock())
return false; return false;
#if IS_LLCOMMON_INLINE
mLockingThread.reset_inline(); mLockingThread.reset_inline();
#else
mLockingThread.reset();
#endif
return true; return true;
} }
@@ -321,7 +336,11 @@ public:
// Returns true if locked by this thread. // Returns true if locked by this thread.
bool isSelfLocked() const bool isSelfLocked() const
{ {
#if IS_LLCOMMON_INLINE
return mLockingThread.equals_current_thread_inline(); return mLockingThread.equals_current_thread_inline();
#else
return mLockingThread.equals_current_thread();
#endif
} }
#ifdef NEEDS_MUTEX_IMPL #ifdef NEEDS_MUTEX_IMPL
@@ -426,16 +445,20 @@ public:
{} {}
~LLCondition() ~LLCondition()
{} {}
void LL_COMMON_API wait() void wait()
{ {
#if IS_LLCOMMON_INLINE
if (AIThreadID::in_main_thread_inline()) if (AIThreadID::in_main_thread_inline())
#else
if (AIThreadID::in_main_thread())
#endif
wait_main(); wait_main();
else LLConditionVariableImpl::wait(*this); else LLConditionVariableImpl::wait(*this);
} }
void signal() { LLConditionVariableImpl::notify_one(); } void signal() { LLConditionVariableImpl::notify_one(); }
void broadcast() { LLConditionVariableImpl::notify_all(); } void broadcast() { LLConditionVariableImpl::notify_all(); }
private: private:
void wait_main(); //Cannot be inline. Uses internal fasttimer. LL_COMMON_API void wait_main(); //Cannot be inline. Uses internal fasttimer.
}; };
class LLMutexLock class LLMutexLock
@@ -646,7 +669,7 @@ public:
void unref() void unref()
{ {
llassert(mRef > 0); llassert(mRef > 0);
if (!--mRef) delete this; if (--mRef == 0) delete this;
} }
S32 getNumRefs() const S32 getNumRefs() const
{ {

View File

@@ -120,10 +120,11 @@ LLPluginMessagePipe::~LLPluginMessagePipe()
bool LLPluginMessagePipe::addMessage(const std::string &message) bool LLPluginMessagePipe::addMessage(const std::string &message)
{ {
// queue the message for later output // queue the message for later output
LLMutexLock lock(&mOutputMutex); //LLMutexLock lock(&mOutputMutex);
mOutputMutex.lock();
mOutput += message; mOutput += message;
mOutput += MESSAGE_DELIMITER; // message separator mOutput += MESSAGE_DELIMITER; // message separator
mOutputMutex.unlock();
return true; return true;
} }