[Sync] Project Sync plus Revision changes

The main revision system changes are based on FoeReapers work in:
b37de3b83e
This commit is contained in:
Antz 2016-03-24 17:58:53 +00:00 committed by Antz
parent f5e2d53ccc
commit bf4b6fafc5
39 changed files with 684 additions and 416 deletions

View file

@ -131,7 +131,7 @@ Thread::~Thread()
}
// initialize Thread's class static member
Thread::ThreadStorage Thread::m_ThreadStorage;
Thread::ThreadStorage *Thread::m_ThreadStorage = NULL;
ThreadPriority Thread::m_TpEnum;
bool Thread::start()
@ -142,6 +142,8 @@ bool Thread::start()
// incRef before spawing the thread, otherwise Thread::ThreadTask() might call decRef and delete m_task
m_task->incReference();
m_ThreadStorage = new ACE_TSS<Thread>();
bool res = (ACE_Thread::spawn(&Thread::ThreadTask, (void*)m_task, THREADFLAG, &m_iThreadId, &m_hThreadHandle) == 0);
if (res)
@ -160,6 +162,8 @@ bool Thread::wait()
m_iThreadId = 0;
m_hThreadHandle = 0;
delete m_ThreadStorage;
m_ThreadStorage = NULL;
return (_res == 0);
}
@ -174,6 +178,8 @@ void Thread::destroy()
m_iThreadId = 0;
m_hThreadHandle = 0;
delete m_ThreadStorage;
m_ThreadStorage = NULL;
// reference set at ACE_Thread::spawn
m_task->decReference();
@ -217,14 +223,14 @@ ACE_hthread_t Thread::currentHandle()
Thread* Thread::current()
{
Thread* _thread = m_ThreadStorage.ts_object();
Thread* _thread = (*m_ThreadStorage).ts_object();
if (!_thread)
{
_thread = new Thread();
_thread->m_iThreadId = Thread::currentId();
_thread->m_hThreadHandle = Thread::currentHandle();
Thread* _oldValue = m_ThreadStorage.ts_object(_thread);
Thread* _oldValue = (*m_ThreadStorage).ts_object(_thread);
delete _oldValue;
}

View file

@ -226,7 +226,7 @@ namespace ACE_Based
*
*/
typedef ACE_TSS<Thread> ThreadStorage;
static ThreadStorage m_ThreadStorage; /**< global object - container for Thread class representation of every thread */
static ThreadStorage *m_ThreadStorage; /**< global object - container for Thread class representation of every thread */
static ThreadPriority m_TpEnum; /**< use this object to determine current OS thread priority values mapped to enum Priority{} */
};
}