AIAPRPool, AIAPRRootPool, AIVolatileAPRPool, AIThreadLocalData etc, were rebranded by LL. Merging change to clean up diffs.

This commit is contained in:
Shyotl
2011-09-20 22:08:48 -05:00
parent d917bf6b06
commit 244e30297f
25 changed files with 486 additions and 175 deletions

View File

@@ -92,9 +92,8 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
sThreadID = threadp->mID;
#endif
// Create a thread local data.
AIThreadLocalData::create(threadp);
LLThreadLocalData::create(threadp);
// Run the user supplied function
threadp->run();
@@ -305,11 +304,11 @@ static apr_os_thread_t main_thread_id;
LL_COMMON_API bool is_main_thread() { return apr_os_thread_equal(main_thread_id, apr_os_thread_current()); }
#endif
// The thread private handle to access the AIThreadLocalData instance.
apr_threadkey_t* AIThreadLocalData::sThreadLocalDataKey;
// The thread private handle to access the LLThreadLocalData instance.
apr_threadkey_t* LLThreadLocalData::sThreadLocalDataKey;
//static
void AIThreadLocalData::init(void)
void LLThreadLocalData::init(void)
{
// Only do this once.
if (sThreadLocalDataKey)
@@ -317,13 +316,13 @@ void AIThreadLocalData::init(void)
return;
}
apr_status_t status = apr_threadkey_private_create(&sThreadLocalDataKey, &AIThreadLocalData::destroy, AIAPRRootPool::get()());
apr_status_t status = apr_threadkey_private_create(&sThreadLocalDataKey, &LLThreadLocalData::destroy, LLAPRRootPool::get()());
ll_apr_assert_status(status); // Or out of memory, or system-imposed limit on the
// total number of keys per process {PTHREAD_KEYS_MAX}
// total number of keys per process {PTHREAD_KEYS_MAX}
// has been exceeded.
// Create the thread-local data for the main thread (this function is called by the main thread).
AIThreadLocalData::create(NULL);
LLThreadLocalData::create(NULL);
#ifdef SHOW_ASSERT
// This function is called by the main thread.
@@ -333,15 +332,15 @@ void AIThreadLocalData::init(void)
// This is called once for every thread when the thread is destructed.
//static
void AIThreadLocalData::destroy(void* thread_local_data)
void LLThreadLocalData::destroy(void* thread_local_data)
{
delete reinterpret_cast<AIThreadLocalData*>(thread_local_data);
delete static_cast<LLThreadLocalData*>(thread_local_data);
}
//static
void AIThreadLocalData::create(LLThread* threadp)
void LLThreadLocalData::create(LLThread* threadp)
{
AIThreadLocalData* new_tld = new AIThreadLocalData;
LLThreadLocalData* new_tld = new LLThreadLocalData;
if (threadp)
{
threadp->mThreadLocalData = new_tld;
@@ -351,19 +350,49 @@ void AIThreadLocalData::create(LLThread* threadp)
}
//static
AIThreadLocalData& AIThreadLocalData::tldata(void)
LLThreadLocalData& LLThreadLocalData::tldata(void)
{
if (!sThreadLocalDataKey)
AIThreadLocalData::init();
{
LLThreadLocalData::init();
}
void* data;
apr_status_t status = apr_threadkey_private_get(&data, sThreadLocalDataKey);
llassert_always(status == APR_SUCCESS);
return *static_cast<AIThreadLocalData*>(data);
return *static_cast<LLThreadLocalData*>(data);
}
//============================================================================
LLCondition::LLCondition(LLAPRPool& parent) : LLMutex(parent)
{
apr_thread_cond_create(&mAPRCondp, mPool());
}
LLCondition::~LLCondition()
{
apr_thread_cond_destroy(mAPRCondp);
mAPRCondp = NULL;
}
void LLCondition::wait()
{
apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
}
void LLCondition::signal()
{
apr_thread_cond_signal(mAPRCondp);
}
void LLCondition::broadcast()
{
apr_thread_cond_broadcast(mAPRCondp);
}
//============================================================================
void LLMutexBase::lock()
{
#if LL_DARWIN
@@ -429,36 +458,6 @@ U32 LLMutexBase::lockingThread() const
}
//============================================================================
LLCondition::LLCondition(AIAPRPool& parent) : LLMutex(parent)
{
apr_thread_cond_create(&mAPRCondp, mPool());
}
LLCondition::~LLCondition()
{
apr_thread_cond_destroy(mAPRCondp);
mAPRCondp = NULL;
}
void LLCondition::wait()
{
apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
}
void LLCondition::signal()
{
apr_thread_cond_signal(mAPRCondp);
}
void LLCondition::broadcast()
{
apr_thread_cond_broadcast(mAPRCondp);
}
//============================================================================
//----------------------------------------------------------------------------
//static