WorkerThread -> RageWorkerThread
This commit is contained in:
@@ -63,7 +63,7 @@ static const CString MEM_CARD_MOUNT_POINT_INTERNAL[NUM_PLAYERS] =
|
||||
};
|
||||
|
||||
/* Only access the memory card driver in a timeout-safe thread. */
|
||||
class ThreadedMemoryCardWorker: public WorkerThread
|
||||
class ThreadedMemoryCardWorker: public RageWorkerThread
|
||||
{
|
||||
public:
|
||||
ThreadedMemoryCardWorker();
|
||||
@@ -132,7 +132,7 @@ bool ThreadedMemoryCardWorker::StorageDevicesChanged( vector<UsbStorageDevice> &
|
||||
|
||||
|
||||
ThreadedMemoryCardWorker::ThreadedMemoryCardWorker():
|
||||
WorkerThread("ThreadedMemoryCardWorker"),
|
||||
RageWorkerThread("MemoryCardWorker"),
|
||||
UsbStorageDevicesMutex("UsbStorageDevicesMutex")
|
||||
{
|
||||
m_pDriver = MakeMemoryCardDriver();
|
||||
|
||||
@@ -66,7 +66,7 @@ enum ThreadRequest
|
||||
};
|
||||
|
||||
/* This is the class that does most of the work. */
|
||||
class ThreadedFileWorker: public WorkerThread
|
||||
class ThreadedFileWorker: public RageWorkerThread
|
||||
{
|
||||
public:
|
||||
ThreadedFileWorker( CString sPath );
|
||||
@@ -151,7 +151,7 @@ void RageFileDriverTimeout::SetTimeout( float fSeconds )
|
||||
|
||||
|
||||
ThreadedFileWorker::ThreadedFileWorker( CString sPath ):
|
||||
WorkerThread( sPath ),
|
||||
RageWorkerThread( sPath ),
|
||||
m_DeletedFilesLock( sPath + "DeletedFilesLock" )
|
||||
{
|
||||
/* Grab a reference to the child driver. We'll operate on it directly. */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
WorkerThread::WorkerThread( const CString &sName ):
|
||||
RageWorkerThread::RageWorkerThread( const CString &sName ):
|
||||
m_WorkerEvent( "\"" + sName + "\" worker event" ),
|
||||
m_HeartbeatEvent( "\"" + sName + "\" heartbeat event" )
|
||||
{
|
||||
@@ -14,16 +14,16 @@ WorkerThread::WorkerThread( const CString &sName ):
|
||||
m_fHeartbeat = -1;
|
||||
m_bRequestFinished = false;
|
||||
|
||||
m_WorkerThread.SetName( "WorkerThread (" + sName + ")" );
|
||||
m_WorkerThread.SetName( "Worker thread (" + sName + ")" );
|
||||
}
|
||||
|
||||
WorkerThread::~WorkerThread()
|
||||
RageWorkerThread::~RageWorkerThread()
|
||||
{
|
||||
/* The worker thread must be stopped by the derived class. */
|
||||
ASSERT( !m_WorkerThread.IsCreated() );
|
||||
}
|
||||
|
||||
void WorkerThread::SetTimeout( float fSeconds )
|
||||
void RageWorkerThread::SetTimeout( float fSeconds )
|
||||
{
|
||||
m_WorkerEvent.Lock();
|
||||
if( fSeconds < 0 )
|
||||
@@ -37,14 +37,14 @@ void WorkerThread::SetTimeout( float fSeconds )
|
||||
}
|
||||
|
||||
|
||||
void WorkerThread::StartThread()
|
||||
void RageWorkerThread::StartThread()
|
||||
{
|
||||
ASSERT( !m_WorkerThread.IsCreated() );
|
||||
|
||||
m_WorkerThread.Create( StartWorkerMain, this );
|
||||
}
|
||||
|
||||
void WorkerThread::StopThread()
|
||||
void RageWorkerThread::StopThread()
|
||||
{
|
||||
/* If we're timed out, wait. */
|
||||
m_WorkerEvent.Lock();
|
||||
@@ -65,7 +65,7 @@ void WorkerThread::StopThread()
|
||||
m_WorkerThread.Wait();
|
||||
}
|
||||
|
||||
bool WorkerThread::DoRequest( int iRequest )
|
||||
bool RageWorkerThread::DoRequest( int iRequest )
|
||||
{
|
||||
ASSERT( !m_bTimedOut );
|
||||
ASSERT( m_iRequest == REQ_NONE );
|
||||
@@ -107,7 +107,7 @@ bool WorkerThread::DoRequest( int iRequest )
|
||||
return bRequestFinished;
|
||||
}
|
||||
|
||||
void WorkerThread::WorkerMain()
|
||||
void RageWorkerThread::WorkerMain()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
@@ -186,7 +186,7 @@ void WorkerThread::WorkerMain()
|
||||
}
|
||||
}
|
||||
|
||||
bool WorkerThread::WaitForOneHeartbeat()
|
||||
bool RageWorkerThread::WaitForOneHeartbeat()
|
||||
{
|
||||
/* It doesn't make sense to wait for a heartbeat if there is no heartbeat. */
|
||||
ASSERT( m_fHeartbeat != -1 );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* WorkerThread - a worker thread for operations that are allowed to time out. */
|
||||
/* RageWorkerThread - a worker thread for operations that are allowed to time out. */
|
||||
|
||||
#ifndef RAGE_UTIL_WORKER_THREAD_H
|
||||
#define RAGE_UTIL_WORKER_THREAD_H
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "RageThreads.h"
|
||||
#include "RageTimer.h"
|
||||
|
||||
class WorkerThread
|
||||
class RageWorkerThread
|
||||
{
|
||||
public:
|
||||
WorkerThread( const CString &sName );
|
||||
virtual ~WorkerThread();
|
||||
RageWorkerThread( const CString &sName );
|
||||
virtual ~RageWorkerThread();
|
||||
|
||||
/* Call SetTimeout(10) to start a timeout period of 10 seconds. This is not a
|
||||
* per-request timeout; you have 10 seconds to do your work, at which point all
|
||||
@@ -49,7 +49,7 @@ protected:
|
||||
virtual void DoHeartbeat() { }
|
||||
|
||||
private:
|
||||
static int StartWorkerMain( void *pThis ) { ((WorkerThread *) (pThis))->WorkerMain(); return 0; }
|
||||
static int StartWorkerMain( void *pThis ) { ((RageWorkerThread *) (pThis))->WorkerMain(); return 0; }
|
||||
void WorkerMain();
|
||||
|
||||
enum { REQ_SHUTDOWN = -1, REQ_NONE = -2 };
|
||||
|
||||
Reference in New Issue
Block a user