From 08376fc0f16c77dcba1b552051fd98faef43f4c5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 21 Dec 2005 06:10:41 +0000 Subject: [PATCH] WorkerThread -> RageWorkerThread --- stepmania/src/MemoryCardManager.cpp | 4 ++-- stepmania/src/RageFileDriverTimeout.cpp | 4 ++-- stepmania/src/RageUtil_WorkerThread.cpp | 18 +++++++++--------- stepmania/src/RageUtil_WorkerThread.h | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/stepmania/src/MemoryCardManager.cpp b/stepmania/src/MemoryCardManager.cpp index d4e069c5a2..7e533cfb38 100644 --- a/stepmania/src/MemoryCardManager.cpp +++ b/stepmania/src/MemoryCardManager.cpp @@ -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 & ThreadedMemoryCardWorker::ThreadedMemoryCardWorker(): - WorkerThread("ThreadedMemoryCardWorker"), + RageWorkerThread("MemoryCardWorker"), UsbStorageDevicesMutex("UsbStorageDevicesMutex") { m_pDriver = MakeMemoryCardDriver(); diff --git a/stepmania/src/RageFileDriverTimeout.cpp b/stepmania/src/RageFileDriverTimeout.cpp index a60f0146ac..5353d188e2 100644 --- a/stepmania/src/RageFileDriverTimeout.cpp +++ b/stepmania/src/RageFileDriverTimeout.cpp @@ -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. */ diff --git a/stepmania/src/RageUtil_WorkerThread.cpp b/stepmania/src/RageUtil_WorkerThread.cpp index ecc13b71e4..3c78dda84e 100644 --- a/stepmania/src/RageUtil_WorkerThread.cpp +++ b/stepmania/src/RageUtil_WorkerThread.cpp @@ -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 ); diff --git a/stepmania/src/RageUtil_WorkerThread.h b/stepmania/src/RageUtil_WorkerThread.h index 9d79235d6a..aaac344585 100644 --- a/stepmania/src/RageUtil_WorkerThread.h +++ b/stepmania/src/RageUtil_WorkerThread.h @@ -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 };