mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
revert ThreadPool rename
revert ThreadPool rename, resources ThreadPool class is already nested in namespace VHACD
This commit is contained in:
parent
8cf2b1d0ef
commit
81a913616c
|
|
@ -262,7 +262,7 @@ void StandardMainLoop::init()
|
|||
RedBook::init();
|
||||
Platform::initConsole();
|
||||
|
||||
TorqueThreadPool::GlobalThreadPool::createSingleton();
|
||||
ThreadPool::GlobalThreadPool::createSingleton();
|
||||
|
||||
// Set engineAPI initialized to true
|
||||
engineAPI::gIsInitialized = true;
|
||||
|
|
@ -293,7 +293,7 @@ void StandardMainLoop::init()
|
|||
|
||||
Con::setVariable("TorqueScriptFileExtension", TORQUE_SCRIPT_EXTENSION);
|
||||
|
||||
Con::addVariable( "_forceAllMainThread", TypeBool, &TorqueThreadPool::getForceAllMainThread(), "Force all work items to execute on main thread. turns this into a single-threaded system. Primarily useful to find whether malfunctions are caused by parallel execution or not.\n"
|
||||
Con::addVariable( "_forceAllMainThread", TypeBool, &ThreadPool::getForceAllMainThread(), "Force all work items to execute on main thread. turns this into a single-threaded system. Primarily useful to find whether malfunctions are caused by parallel execution or not.\n"
|
||||
"@ingroup platform" );
|
||||
|
||||
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
|
||||
|
|
@ -351,7 +351,7 @@ void StandardMainLoop::shutdown()
|
|||
|
||||
EngineModuleManager::shutdownSystem();
|
||||
|
||||
TorqueThreadPool::GlobalThreadPool::deleteSingleton();
|
||||
ThreadPool::GlobalThreadPool::deleteSingleton();
|
||||
|
||||
#ifdef TORQUE_ENABLE_VFS
|
||||
closeEmbeddedVFSArchive();
|
||||
|
|
@ -636,7 +636,7 @@ bool StandardMainLoop::doMainLoop()
|
|||
if(!Process::processEvents())
|
||||
keepRunning = false;
|
||||
|
||||
TorqueThreadPool::processMainThreadWorkItems();
|
||||
ThreadPool::processMainThreadWorkItems();
|
||||
Sampler::endFrame();
|
||||
ConsoleValue::resetConversionBuffer();
|
||||
PROFILE_END_NAMED(MainLoop);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace ImageUtil
|
|||
}
|
||||
|
||||
//Thread work job for compression
|
||||
struct CompressJob : public TorqueThreadPool::WorkItem
|
||||
struct CompressJob : public ThreadPool::WorkItem
|
||||
{
|
||||
S32 width;
|
||||
S32 height;
|
||||
|
|
@ -124,7 +124,7 @@ namespace ImageUtil
|
|||
srcDDS->mFlags.set(DDSFile::CompressedData);
|
||||
|
||||
//grab global thread pool
|
||||
TorqueThreadPool* pThreadPool = &TorqueThreadPool::GLOBAL();
|
||||
ThreadPool* pThreadPool = &ThreadPool::GLOBAL();
|
||||
|
||||
if (cubemap)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ void TheoraTexture::_onTextureEvent( GFXTexCallbackCode code )
|
|||
{
|
||||
// Blast out work items and then release all texture locks.
|
||||
|
||||
TorqueThreadPool::GLOBAL().flushWorkItems();
|
||||
ThreadPool::GLOBAL().flushWorkItems();
|
||||
mAsyncState->getFrameStream()->releaseTextureLocks();
|
||||
|
||||
// The Theora decoder does not implement seeking at the moment,
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class TheoraTexture : private IOutputStream< TheoraTextureFrame* >,
|
|||
|
||||
///
|
||||
FrameReadItem( AsyncBufferedInputStream< TheoraTextureFrame*, IInputStream< OggTheoraFrame* >* >* stream,
|
||||
TorqueThreadPool::Context* context );
|
||||
ThreadPool::Context* context );
|
||||
};
|
||||
|
||||
/// Stream filter that turns a stream of OggTheoraFrames into a buffered background stream of TheoraTextureFrame
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class AsyncBufferedInputStream : public IInputStreamFilter< T, Stream >,
|
|||
ElementList mBufferedElements;
|
||||
|
||||
/// The thread pool to which read items are queued.
|
||||
TorqueThreadPool* mThreadPool;
|
||||
ThreadPool* mThreadPool;
|
||||
|
||||
/// The thread context used for prioritizing read items in the pool.
|
||||
ThreadContext* mThreadContext;
|
||||
|
|
@ -132,7 +132,7 @@ class AsyncBufferedInputStream : public IInputStreamFilter< T, Stream >,
|
|||
U32 numSourceElementsToRead = 0,
|
||||
U32 numReadAhead = DEFAULT_STREAM_LOOKAHEAD,
|
||||
bool isLooping = false,
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL(),
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL(),
|
||||
ThreadContext* context = ThreadContext::ROOT_CONTEXT() );
|
||||
|
||||
virtual ~AsyncBufferedInputStream();
|
||||
|
|
@ -162,7 +162,7 @@ AsyncBufferedInputStream< T, Stream >::AsyncBufferedInputStream
|
|||
U32 numSourceElementsToRead,
|
||||
U32 numReadAhead,
|
||||
bool isLooping,
|
||||
TorqueThreadPool* threadPool,
|
||||
ThreadPool* threadPool,
|
||||
ThreadContext* threadContext )
|
||||
: Parent( stream ),
|
||||
mIsLooping( isLooping ),
|
||||
|
|
@ -321,7 +321,7 @@ class AsyncBufferedReadItem : public ThreadWorkItem
|
|||
///
|
||||
AsyncBufferedReadItem(
|
||||
const AsyncStreamRef& asyncStream,
|
||||
TorqueThreadPool::Context* context = NULL
|
||||
ThreadPool::Context* context = NULL
|
||||
)
|
||||
: Parent( context ),
|
||||
mAsyncStream( asyncStream ),
|
||||
|
|
@ -376,7 +376,7 @@ class AsyncSingleBufferedInputStream : public AsyncBufferedInputStream< T, Strea
|
|||
U32 numSourceElementsToRead = 0,
|
||||
U32 numReadAhead = Parent::DEFAULT_STREAM_LOOKAHEAD,
|
||||
bool isLooping = false,
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL(),
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL(),
|
||||
ThreadContext* context = ThreadContext::ROOT_CONTEXT() )
|
||||
: Parent( stream,
|
||||
numSourceElementsToRead,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class AsyncPacketBufferedInputStream : public AsyncBufferedInputStream< Packet*,
|
|||
PacketReadItem( const ThreadSafeRef< AsyncPacketBufferedInputStream< Stream, Packet > >& asyncStream,
|
||||
PacketType* packet,
|
||||
U32 numElements,
|
||||
TorqueThreadPool::Context* context = NULL )
|
||||
ThreadPool::Context* context = NULL )
|
||||
: Parent( asyncStream->getSourceStream(), numElements, 0, *packet, false, 0, context ),
|
||||
mAsyncStream( asyncStream ),
|
||||
mPacket( packet ) {}
|
||||
|
|
@ -227,7 +227,7 @@ class AsyncPacketBufferedInputStream : public AsyncBufferedInputStream< Packet*,
|
|||
U32 numSourceElementsToRead = 0,
|
||||
U32 numReadAhead = Parent::DEFAULT_STREAM_LOOKAHEAD,
|
||||
bool isLooping = false,
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL(),
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL(),
|
||||
ThreadContext* context = ThreadContext::ROOT_CONTEXT() );
|
||||
|
||||
/// @return the size of stream packets returned by this stream in number of elements.
|
||||
|
|
@ -241,7 +241,7 @@ AsyncPacketBufferedInputStream< Stream, Packet >::AsyncPacketBufferedInputStream
|
|||
U32 numSourceElementsToRead,
|
||||
U32 numReadAhead,
|
||||
bool isLooping,
|
||||
TorqueThreadPool* threadPool,
|
||||
ThreadPool* threadPool,
|
||||
ThreadContext* threadContext )
|
||||
: Parent( stream, numSourceElementsToRead, numReadAhead, isLooping, threadPool, threadContext ),
|
||||
mPacketSize( packetSize ),
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ struct NetAsync::NameLookupRequest
|
|||
|
||||
/// Work item issued to the thread pool for each lookup request.
|
||||
|
||||
struct NetAsync::NameLookupWorkItem : public TorqueThreadPool::WorkItem
|
||||
struct NetAsync::NameLookupWorkItem : public ThreadPool::WorkItem
|
||||
{
|
||||
typedef TorqueThreadPool::WorkItem Parent;
|
||||
typedef ThreadPool::WorkItem Parent;
|
||||
|
||||
NameLookupWorkItem( NameLookupRequest& request, TorqueThreadPool::Context* context = 0 )
|
||||
NameLookupWorkItem( NameLookupRequest& request, ThreadPool::Context* context = 0 )
|
||||
: Parent( context ),
|
||||
mRequest( request )
|
||||
{
|
||||
|
|
@ -133,7 +133,7 @@ void NetAsync::queueLookup(const char* remoteAddr, NetSocket socket)
|
|||
dStrncpy(lookupRequest.remoteAddr, remoteAddr, sizeof(lookupRequest.remoteAddr));
|
||||
|
||||
ThreadSafeRef< NameLookupWorkItem > workItem( new NameLookupWorkItem( lookupRequest ) );
|
||||
TorqueThreadPool::GLOBAL().queueWorkItem( workItem );
|
||||
ThreadPool::GLOBAL().queueWorkItem( workItem );
|
||||
}
|
||||
|
||||
bool NetAsync::checkLookup(NetSocket socket, void* out_h_addr,
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@
|
|||
// ThreadPool::Context.
|
||||
//=============================================================================
|
||||
|
||||
TorqueThreadPool::Context TorqueThreadPool::Context::smRootContext( "ROOT", NULL, 1.0 );
|
||||
ThreadPool::Context ThreadPool::Context::smRootContext( "ROOT", NULL, 1.0 );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TorqueThreadPool::Context::Context( const char* name, TorqueThreadPool::Context* parent, F32 priorityBias )
|
||||
ThreadPool::Context::Context( const char* name, ThreadPool::Context* parent, F32 priorityBias )
|
||||
: mParent( parent ),
|
||||
mName( name ),
|
||||
mChildren( 0 ),
|
||||
|
|
@ -55,7 +55,7 @@ TorqueThreadPool::Context::Context( const char* name, TorqueThreadPool::Context*
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TorqueThreadPool::Context::~Context()
|
||||
ThreadPool::Context::~Context()
|
||||
{
|
||||
if( mParent )
|
||||
for( Context* context = mParent->mChildren, *prev = 0; context != 0; prev = context, context = context->mSibling )
|
||||
|
|
@ -70,7 +70,7 @@ TorqueThreadPool::Context::~Context()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TorqueThreadPool::Context* TorqueThreadPool::Context::getChild( const char* name )
|
||||
ThreadPool::Context* ThreadPool::Context::getChild( const char* name )
|
||||
{
|
||||
for( Context* child = getChildren(); child != 0; child = child->getSibling() )
|
||||
if( dStricmp( child->getName(), name ) == 0 )
|
||||
|
|
@ -80,7 +80,7 @@ TorqueThreadPool::Context* TorqueThreadPool::Context::getChild( const char* name
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
F32 TorqueThreadPool::Context::getAccumulatedPriorityBias()
|
||||
F32 ThreadPool::Context::getAccumulatedPriorityBias()
|
||||
{
|
||||
if( !mAccumulatedPriorityBias )
|
||||
updateAccumulatedPriorityBiases();
|
||||
|
|
@ -89,7 +89,7 @@ F32 TorqueThreadPool::Context::getAccumulatedPriorityBias()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::Context::setPriorityBias( F32 value )
|
||||
void ThreadPool::Context::setPriorityBias( F32 value )
|
||||
{
|
||||
mPriorityBias = value;
|
||||
mAccumulatedPriorityBias = 0.0;
|
||||
|
|
@ -97,7 +97,7 @@ void TorqueThreadPool::Context::setPriorityBias( F32 value )
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::Context::updateAccumulatedPriorityBiases()
|
||||
void ThreadPool::Context::updateAccumulatedPriorityBiases()
|
||||
{
|
||||
// Update our own priority bias.
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ void TorqueThreadPool::Context::updateAccumulatedPriorityBiases()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::WorkItem::process()
|
||||
void ThreadPool::WorkItem::process()
|
||||
{
|
||||
execute();
|
||||
mExecuted = true;
|
||||
|
|
@ -125,14 +125,14 @@ void TorqueThreadPool::WorkItem::process()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
bool TorqueThreadPool::WorkItem::isCancellationRequested()
|
||||
bool ThreadPool::WorkItem::isCancellationRequested()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
bool TorqueThreadPool::WorkItem::cancellationPoint()
|
||||
bool ThreadPool::WorkItem::cancellationPoint()
|
||||
{
|
||||
if( isCancellationRequested() )
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ bool TorqueThreadPool::WorkItem::cancellationPoint()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
F32 TorqueThreadPool::WorkItem::getPriority()
|
||||
F32 ThreadPool::WorkItem::getPriority()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ F32 TorqueThreadPool::WorkItem::getPriority()
|
|||
/// @see ThreadSafePriorityQueueWithUpdate
|
||||
/// @see ThreadPool::WorkItem
|
||||
///
|
||||
struct TorqueThreadPool::WorkItemWrapper : public ThreadSafeRef< WorkItem >
|
||||
struct ThreadPool::WorkItemWrapper : public ThreadSafeRef< WorkItem >
|
||||
{
|
||||
typedef ThreadSafeRef< WorkItem > Parent;
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ struct TorqueThreadPool::WorkItemWrapper : public ThreadSafeRef< WorkItem >
|
|||
F32 getPriority();
|
||||
};
|
||||
|
||||
inline bool TorqueThreadPool::WorkItemWrapper::isAlive()
|
||||
inline bool ThreadPool::WorkItemWrapper::isAlive()
|
||||
{
|
||||
WorkItem* item = ptr();
|
||||
if( !item )
|
||||
|
|
@ -186,7 +186,7 @@ inline bool TorqueThreadPool::WorkItemWrapper::isAlive()
|
|||
return true;
|
||||
}
|
||||
|
||||
inline F32 TorqueThreadPool::WorkItemWrapper::getPriority()
|
||||
inline F32 ThreadPool::WorkItemWrapper::getPriority()
|
||||
{
|
||||
WorkItem* item = ptr();
|
||||
AssertFatal( item != 0, "ThreadPool::WorkItemWrapper::getPriority - called on dead item" );
|
||||
|
|
@ -201,20 +201,20 @@ inline F32 TorqueThreadPool::WorkItemWrapper::getPriority()
|
|||
|
||||
///
|
||||
///
|
||||
struct TorqueThreadPool::WorkerThread : public Thread
|
||||
struct ThreadPool::WorkerThread : public Thread
|
||||
{
|
||||
WorkerThread( TorqueThreadPool* pool, U32 index );
|
||||
WorkerThread( ThreadPool* pool, U32 index );
|
||||
|
||||
WorkerThread* getNext();
|
||||
void run( void* arg = 0 ) override;
|
||||
|
||||
private:
|
||||
U32 mIndex;
|
||||
TorqueThreadPool* mPool;
|
||||
ThreadPool* mPool;
|
||||
WorkerThread* mNext;
|
||||
};
|
||||
|
||||
TorqueThreadPool::WorkerThread::WorkerThread( TorqueThreadPool* pool, U32 index )
|
||||
ThreadPool::WorkerThread::WorkerThread( ThreadPool* pool, U32 index )
|
||||
: mIndex( index ),
|
||||
mPool( pool )
|
||||
{
|
||||
|
|
@ -224,12 +224,12 @@ TorqueThreadPool::WorkerThread::WorkerThread( TorqueThreadPool* pool, U32 index
|
|||
pool->mThreads = this;
|
||||
}
|
||||
|
||||
inline TorqueThreadPool::WorkerThread* TorqueThreadPool::WorkerThread::getNext()
|
||||
inline ThreadPool::WorkerThread* ThreadPool::WorkerThread::getNext()
|
||||
{
|
||||
return mNext;
|
||||
}
|
||||
|
||||
void TorqueThreadPool::WorkerThread::run( void* arg )
|
||||
void ThreadPool::WorkerThread::run( void* arg )
|
||||
{
|
||||
#ifdef TORQUE_DEBUG
|
||||
{
|
||||
|
|
@ -300,13 +300,13 @@ void TorqueThreadPool::WorkerThread::run( void* arg )
|
|||
// ThreadPool.
|
||||
//=============================================================================
|
||||
|
||||
bool TorqueThreadPool::smForceAllMainThread;
|
||||
U32 TorqueThreadPool::smMainThreadTimeMS;
|
||||
TorqueThreadPool::QueueType TorqueThreadPool::smMainThreadQueue;
|
||||
bool ThreadPool::smForceAllMainThread;
|
||||
U32 ThreadPool::smMainThreadTimeMS;
|
||||
ThreadPool::QueueType ThreadPool::smMainThreadQueue;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TorqueThreadPool::TorqueThreadPool( const char* name, U32 numThreads )
|
||||
ThreadPool::ThreadPool( const char* name, U32 numThreads )
|
||||
: mName( name ),
|
||||
mNumThreads( numThreads ),
|
||||
mNumThreadsAwake( 0 ),
|
||||
|
|
@ -347,14 +347,14 @@ TorqueThreadPool::TorqueThreadPool( const char* name, U32 numThreads )
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TorqueThreadPool::~TorqueThreadPool()
|
||||
ThreadPool::~ThreadPool()
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::shutdown()
|
||||
void ThreadPool::shutdown()
|
||||
{
|
||||
const U32 numThreads = mNumThreads;
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ void TorqueThreadPool::shutdown()
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::queueWorkItem( WorkItem* item )
|
||||
void ThreadPool::queueWorkItem( WorkItem* item )
|
||||
{
|
||||
bool executeRightAway = ( getForceAllMainThread() );
|
||||
#ifdef DEBUG_SPEW
|
||||
|
|
@ -410,7 +410,7 @@ void TorqueThreadPool::queueWorkItem( WorkItem* item )
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::flushWorkItems( S32 timeOut )
|
||||
void ThreadPool::flushWorkItems( S32 timeOut )
|
||||
{
|
||||
AssertFatal( mNumThreads, "ThreadPool::flushWorkItems() - no worker threads in pool" );
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ void TorqueThreadPool::flushWorkItems( S32 timeOut )
|
|||
}
|
||||
}
|
||||
|
||||
void TorqueThreadPool::waitForAllItems( S32 timeOut )
|
||||
void ThreadPool::waitForAllItems( S32 timeOut )
|
||||
{
|
||||
U32 endTime = 0;
|
||||
if( timeOut != -1 )
|
||||
|
|
@ -454,14 +454,14 @@ void TorqueThreadPool::waitForAllItems( S32 timeOut )
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::queueWorkItemOnMainThread( WorkItem* item )
|
||||
void ThreadPool::queueWorkItemOnMainThread( WorkItem* item )
|
||||
{
|
||||
smMainThreadQueue.insert( item->getPriority(), item );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void TorqueThreadPool::processMainThreadWorkItems()
|
||||
void ThreadPool::processMainThreadWorkItems()
|
||||
{
|
||||
AssertFatal( ThreadManager::isMainThread(),
|
||||
"ThreadPool::processMainThreadWorkItems - this function must only be called on the main thread" );
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
/// automatically being released once the last concurrent work item has been
|
||||
/// processed or discarded.
|
||||
///
|
||||
class TorqueThreadPool
|
||||
class ThreadPool
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -298,9 +298,9 @@ class TorqueThreadPool
|
|||
/// will be based on the number of CPU cores available.
|
||||
///
|
||||
/// @param numThreads Number of threads to create or zero for default.
|
||||
TorqueThreadPool( const char* name, U32 numThreads = 0 );
|
||||
ThreadPool( const char* name, U32 numThreads = 0 );
|
||||
|
||||
~TorqueThreadPool();
|
||||
~ThreadPool();
|
||||
|
||||
/// Manually shutdown threads outside of static destructors.
|
||||
void shutdown();
|
||||
|
|
@ -397,16 +397,16 @@ class TorqueThreadPool
|
|||
}
|
||||
|
||||
/// Return the global thread pool singleton.
|
||||
static TorqueThreadPool& GLOBAL();
|
||||
static ThreadPool& GLOBAL();
|
||||
};
|
||||
|
||||
typedef TorqueThreadPool::Context ThreadContext;
|
||||
typedef TorqueThreadPool::WorkItem ThreadWorkItem;
|
||||
typedef ThreadPool::Context ThreadContext;
|
||||
typedef ThreadPool::WorkItem ThreadWorkItem;
|
||||
|
||||
|
||||
struct TorqueThreadPool::GlobalThreadPool : public TorqueThreadPool, public ManagedSingleton< GlobalThreadPool >
|
||||
struct ThreadPool::GlobalThreadPool : public ThreadPool, public ManagedSingleton< GlobalThreadPool >
|
||||
{
|
||||
typedef TorqueThreadPool Parent;
|
||||
typedef ThreadPool Parent;
|
||||
|
||||
GlobalThreadPool()
|
||||
: Parent( "GLOBAL" ) {}
|
||||
|
|
@ -415,7 +415,7 @@ struct TorqueThreadPool::GlobalThreadPool : public TorqueThreadPool, public Mana
|
|||
static const char* getSingletonName() { return "GlobalThreadPool"; }
|
||||
};
|
||||
|
||||
inline TorqueThreadPool& TorqueThreadPool::GLOBAL()
|
||||
inline ThreadPool& ThreadPool::GLOBAL()
|
||||
{
|
||||
return *( GlobalThreadPool::instance() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
///
|
||||
/// @param T Type of elements being streamed.
|
||||
template< typename T, class Stream >
|
||||
class AsyncIOItem : public TorqueThreadPool::WorkItem
|
||||
class AsyncIOItem : public ThreadPool::WorkItem
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -358,11 +358,11 @@ enum
|
|||
/// @note Don't use this directly but rather use THREAD_POOL() instead.
|
||||
/// This way, the sound code may be easily switched to using a common
|
||||
/// pool later on.
|
||||
class SFXThreadPool : public TorqueThreadPool, public ManagedSingleton< SFXThreadPool >
|
||||
class SFXThreadPool : public ThreadPool, public ManagedSingleton< SFXThreadPool >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef TorqueThreadPool Parent;
|
||||
typedef ThreadPool Parent;
|
||||
|
||||
/// Create a ThreadPool called "SFX" with two threads.
|
||||
SFXThreadPool()
|
||||
|
|
@ -399,7 +399,7 @@ extern ThreadSafeRef< SFXBufferProcessList > gBufferUpdateList;
|
|||
extern ThreadSafeDeque< SFXBuffer* > gDeadBufferList;
|
||||
|
||||
/// Return the thread pool used for SFX work.
|
||||
inline TorqueThreadPool& THREAD_POOL()
|
||||
inline ThreadPool& THREAD_POOL()
|
||||
{
|
||||
return *( SFXThreadPool::instance() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ FIXTURE(ThreadPool)
|
|||
public:
|
||||
// Represents a single unit of work. In this test we just set an element in
|
||||
// a result vector.
|
||||
struct TestItem : public TorqueThreadPool::WorkItem
|
||||
struct TestItem : public ThreadPool::WorkItem
|
||||
{
|
||||
U32 mIndex;
|
||||
Vector<U32>& mResults;
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
// A worker that delays for some time. We'll use this to test the ThreadPool's
|
||||
// synchronous and asynchronous operations.
|
||||
struct DelayItem : public TorqueThreadPool::WorkItem
|
||||
struct DelayItem : public ThreadPool::WorkItem
|
||||
{
|
||||
U32 ms;
|
||||
DelayItem(U32 _ms) : ms(_ms) {}
|
||||
|
|
@ -69,7 +69,7 @@ TEST_FIX(ThreadPool, BasicAPI)
|
|||
results[i] = U32(-1);
|
||||
|
||||
// Launch the work items.
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL();
|
||||
for (U32 i = 0; i < numItems; i++)
|
||||
{
|
||||
ThreadSafeRef<TestItem> item(new TestItem(i, results));
|
||||
|
|
@ -89,7 +89,7 @@ TEST_FIX(ThreadPool, Asynchronous)
|
|||
const U32 delay = 500; //ms
|
||||
|
||||
// Launch a single delaying work item.
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL();
|
||||
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
||||
pool->queueWorkItem(item);
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ TEST_FIX(ThreadPool, Synchronous)
|
|||
const U32 delay = 500; //ms
|
||||
|
||||
// Launch a single delaying work item.
|
||||
TorqueThreadPool* pool = &TorqueThreadPool::GLOBAL();
|
||||
ThreadPool* pool = &ThreadPool::GLOBAL();
|
||||
ThreadSafeRef<DelayItem> item(new DelayItem(delay));
|
||||
pool->queueWorkItem(item);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue