Rewrite of AIStateMachine, version 2.

This commit is contained in:
Aleric Inglewood
2013-03-01 00:59:06 +01:00
parent 4851cc174e
commit c4dceaf3e9
22 changed files with 1375 additions and 974 deletions

View File

@@ -51,6 +51,11 @@ void AIThreadID::set_current_thread_id(void)
}
#ifndef LL_DARWIN
void AIThreadID::clear(void)
{
mID = undefinedID;
}
void AIThreadID::reset(void)
{
mID = lCurrentThread;

View File

@@ -63,6 +63,7 @@ public:
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.
#ifndef LL_DARWIN
LL_COMMON_API void clear(void);
LL_COMMON_API void reset(void);
LL_COMMON_API bool equals_current_thread(void) const;
LL_COMMON_API static bool in_main_thread(void);
@@ -74,6 +75,7 @@ public:
static apr_os_thread_t getCurrentThread_inline(void) { return lCurrentThread; }
#else
// Both variants are inline on OS X.
void clear(void) { mID = undefinedID; }
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()); }

View File

@@ -479,9 +479,6 @@ public:
// Only for use by AITHREADSAFESIMPLE, see below.
AIThreadSafeSimple(T* object) { llassert(object == AIThreadSafeBits<T>::ptr()); }
// If MUTEX is a LLCondition then this can be used to wake up the waiting thread.
void signal() { mMutex.signal(); }
#if LL_DEBUG
// Can only be locked when there still exists an AIAccess object that
// references this object and will access it upon destruction.
@@ -622,6 +619,8 @@ struct AIAccessConst
// If MUTEX is an LLCondition, then this can be used to wait for a signal.
void wait() { this->mWrapper.mMutex.wait(); }
// If MUTEX is a LLCondition then this can be used to wake up the waiting thread.
void signal() { this->mWrapper.mMutex.signal(); }
protected:
AIThreadSafeSimple<T, MUTEX>& mWrapper; //!< Reference to the object that we provide access to.