RageThread::CreateThisThread is too different: most of the API
is not valid, and it's used differently. Split it off into RageThreadRegister.
This commit is contained in:
@@ -277,6 +277,33 @@ void RageThread::CreateThisThread()
|
|||||||
m_pSlot->pImpl = MakeThisThread();
|
m_pSlot->pImpl = MakeThisThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RageThreadRegister::RageThreadRegister( const CString &sName )
|
||||||
|
{
|
||||||
|
InitThreads();
|
||||||
|
LockMut( g_ThreadSlotsLock );
|
||||||
|
|
||||||
|
int iSlot = FindEmptyThreadSlot();
|
||||||
|
|
||||||
|
m_pSlot = &g_ThreadSlots[iSlot];
|
||||||
|
|
||||||
|
strcpy( m_pSlot->name, sName );
|
||||||
|
sprintf( m_pSlot->ThreadFormattedOutput, "Thread: %s", sName.c_str() );
|
||||||
|
|
||||||
|
m_pSlot->id = GetThisThreadId();
|
||||||
|
m_pSlot->pImpl = MakeThisThread();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RageThreadRegister::~RageThreadRegister()
|
||||||
|
{
|
||||||
|
LockMut( g_ThreadSlotsLock );
|
||||||
|
|
||||||
|
delete m_pSlot->pImpl;
|
||||||
|
m_pSlot->pImpl = NULL;
|
||||||
|
m_pSlot->Init();
|
||||||
|
m_pSlot = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const char *RageThread::GetCurThreadName()
|
const char *RageThread::GetCurThreadName()
|
||||||
{
|
{
|
||||||
return GetThreadNameByID( GetCurrentThreadID() );
|
return GetThreadNameByID( GetCurrentThreadID() );
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ private:
|
|||||||
static bool s_bIsShowingDialog;
|
static bool s_bIsShowingDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Register a thread created outside of RageThread. This gives it a name for RageThread::GetCurThreadName,
|
||||||
|
* and allocates a slot for checkpoints. */
|
||||||
|
class RageThreadRegister
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RageThreadRegister( const CString &sName );
|
||||||
|
~RageThreadRegister();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ThreadSlot *m_pSlot;
|
||||||
|
};
|
||||||
|
|
||||||
namespace Checkpoints
|
namespace Checkpoints
|
||||||
{
|
{
|
||||||
void LogCheckpoints( bool yes=true );
|
void LogCheckpoints( bool yes=true );
|
||||||
|
|||||||
Reference in New Issue
Block a user