Implementation of a general purpose request / response style background work queue. More...
#include <OgreDefaultWorkQueueStandard.h>
Public Types | |
typedef unsigned long long int | RequestID |
Numeric identifier for a request. More... | |
Public Member Functions | |
DefaultWorkQueue (const String &name=StringUtil::BLANK) | |
DefaultWorkQueue (const String &name=StringUtil::BLANK) | |
virtual | ~DefaultWorkQueue () |
virtual | ~DefaultWorkQueue () |
virtual void | _processNextRequest () |
Process the next request on the queue. More... | |
void | _registerThreadWithRenderSystem () |
Register the current thread with the rendersystem. More... | |
virtual void | _threadMain () |
Main function for each thread spawned. More... | |
virtual void | _threadMain () |
Process the next request on the queue. More... | |
virtual void | abortAllRequests () |
Abort all previously issued requests. More... | |
virtual void | abortPendingRequestsByChannel (uint16 channel) |
Abort all previously issued requests in a given channel. More... | |
virtual void | abortRequest (RequestID id) |
Abort a previously issued request. More... | |
virtual void | abortRequestsByChannel (uint16 channel) |
Abort all previously issued requests in a given channel. More... | |
virtual RequestID | addRequest (uint16 channel, uint16 requestType, const Any &rData, uint8 retryCount=0, bool forceSynchronous=false, bool idleThread=false) |
Add a new request to the queue. More... | |
virtual void | addRequestHandler (uint16 channel, RequestHandler *rh) |
Add a request handler instance to the queue. More... | |
virtual void | addResponseHandler (uint16 channel, ResponseHandler *rh) |
Add a response handler instance to the queue. More... | |
virtual uint16 | getChannel (const String &channelName) |
Get a channel ID for a given channel name. More... | |
const String & | getName () const |
Get the name of the work queue. More... | |
virtual bool | getRequestsAccepted () const |
Returns whether requests are being accepted right now. More... | |
virtual unsigned long | getResponseProcessingTimeLimit () const |
Get the time limit imposed on the processing of responses in a single frame, in milliseconds (0 indicates no limit). More... | |
virtual bool | getWorkersCanAccessRenderSystem () const |
Get whether worker threads will be allowed to access render system resources. More... | |
virtual size_t | getWorkerThreadCount () const |
Get the number of worker threads that this queue will start when startup() is called. More... | |
virtual bool | isPaused () const |
Return whether the queue is paused ie not sending more work to workers. More... | |
virtual bool | isShuttingDown () const |
Returns whether the queue is trying to shut down. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
virtual void | processResponses () |
Process the responses in the queue. More... | |
virtual void | removeRequestHandler (uint16 channel, RequestHandler *rh) |
Remove a request handler. More... | |
virtual void | removeResponseHandler (uint16 channel, ResponseHandler *rh) |
Remove a Response handler. More... | |
virtual void | setPaused (bool pause) |
Set whether to pause further processing of any requests. More... | |
virtual void | setRequestsAccepted (bool accept) |
Set whether to accept new requests or not. More... | |
virtual void | setResponseProcessingTimeLimit (unsigned long ms) |
Set the time limit imposed on the processing of responses in a single frame, in milliseconds (0 indicates no limit). More... | |
virtual void | setWorkersCanAccessRenderSystem (bool access) |
Set whether worker threads will be allowed to access render system resources. More... | |
virtual void | setWorkerThreadCount (size_t c) |
Set the number of worker threads that this queue will start when startup() is called (default 1). More... | |
virtual void | shutdown () |
Shut down the queue. More... | |
virtual void | shutdown () |
Shut down the queue. More... | |
virtual void | startup (bool forceRestart=true) |
Start up the queue with the options that have been set. More... | |
virtual void | startup (bool forceRestart=true) |
Start up the queue with the options that have been set. More... | |
Protected Types | |
typedef map< String, uint16 >::type | ChannelMap |
typedef SharedPtr < RequestHandlerHolder > | RequestHandlerHolderPtr |
typedef list < RequestHandlerHolderPtr > ::type | RequestHandlerList |
typedef map< uint16, RequestHandlerList >::type | RequestHandlerListByChannel |
typedef deque< Request * >::type | RequestQueue |
typedef list< ResponseHandler * > ::type | ResponseHandlerList |
typedef map< uint16, ResponseHandlerList >::type | ResponseHandlerListByChannel |
typedef deque< Response * >::type | ResponseQueue |
Protected Member Functions | |
void | addRequestWithRID (RequestID rid, uint16 channel, uint16 requestType, const Any &rData, uint8 retryCount) |
Put a Request on the queue with a specific RequestID. More... | |
virtual void | notifyThreadRegistered () |
Notify that a thread has registered itself with the render system. More... | |
virtual void | notifyWorkers () |
Notify workers about a new request. More... | |
virtual void | notifyWorkers () |
Notify workers about a new request. More... | |
OGRE_MUTEX (mInitMutex) | |
Init notification mutex (must lock before waiting on initCondition) More... | |
OGRE_MUTEX (mChannelMapMutex) | |
OGRE_MUTEX (mIdleMutex) | |
OGRE_MUTEX (mRequestMutex) | |
OGRE_MUTEX (mProcessMutex) | |
OGRE_MUTEX (mResponseMutex) | |
OGRE_RW_MUTEX (mRequestHandlerMutex) | |
OGRE_THREAD_SYNCHRONISER (mInitSync) | |
Synchroniser token to wait / notify on thread init. More... | |
OGRE_THREAD_SYNCHRONISER (mRequestCondition) | |
bool | processIdleRequests () |
Response * | processRequest (Request *r) |
void | processRequestResponse (Request *r, bool synchronous) |
void | processResponse (Response *r) |
virtual void | waitForNextRequest () |
To be called by a separate thread; will return immediately if there are items in the queue, or suspend the thread until new items are added otherwise. More... | |
Protected Attributes | |
bool | mAcceptRequests |
ChannelMap | mChannelMap |
Request * | mIdleProcessed |
RequestQueue | mIdleRequestQueue |
bool | mIdleThreadRunning |
bool | mIsRunning |
String | mName |
uint16 | mNextChannel |
size_t | mNumThreadsRegisteredWithRS |
bool | mPaused |
RequestQueue | mProcessQueue |
RequestID | mRequestCount |
RequestHandlerListByChannel | mRequestHandlers |
RequestQueue | mRequestQueue |
ResponseHandlerListByChannel | mResponseHandlers |
ResponseQueue | mResponseQueue |
unsigned long | mResposeTimeLimitMS |
bool | mShuttingDown |
WorkerFunc * | mWorkerFunc |
bool | mWorkerRenderSystemAccess |
size_t | mWorkerThreadCount |
Private Member Functions | |
OGRE_MUTEX (mRegisterRSMutex) | |
Synchronise registering threads with the RenderSystem. More... | |
Private Attributes | |
std::set< tbb::tbb_thread::id > | mRegisteredThreads |
tbb::task_group | mTaskGroup |
tbb::task_scheduler_init | mTaskScheduler |
Implementation of a general purpose request / response style background work queue.
Definition at line 38 of file OgreDefaultWorkQueueStandard.h.
|
protectedinherited |
Definition at line 73 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 534 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 536 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 538 of file OgreWorkQueue.h.
|
inherited |
Numeric identifier for a request.
Definition at line 79 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 465 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 537 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 539 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 466 of file OgreWorkQueue.h.
Ogre::DefaultWorkQueue::DefaultWorkQueue | ( | const String & | name = StringUtil::BLANK | ) |
|
virtual |
Ogre::DefaultWorkQueue::DefaultWorkQueue | ( | const String & | name = StringUtil::BLANK | ) |
|
virtual |
|
virtualinherited |
Process the next request on the queue.
void Ogre::DefaultWorkQueue::_registerThreadWithRenderSystem | ( | ) |
Register the current thread with the rendersystem.
|
virtual |
Main function for each thread spawned.
Implements Ogre::DefaultWorkQueueBase.
|
virtual |
Process the next request on the queue.
Implements Ogre::DefaultWorkQueueBase.
|
virtualinherited |
Abort all previously issued requests.
Any requests still waiting to be processed will be removed from the queue. Any requests that are being processed will still complete.
Implements Ogre::WorkQueue.
|
virtualinherited |
Abort all previously issued requests in a given channel.
Any requests still waiting to be processed of the given channel, will be removed from the queue. It will not remove requests, where the request handler is already called.
channel | The type of request to be aborted |
Implements Ogre::WorkQueue.
|
virtualinherited |
Abort a previously issued request.
If the request is still waiting to be processed, it will be removed from the queue.
id | The ID of the previously issued request. |
Implements Ogre::WorkQueue.
|
virtualinherited |
Abort all previously issued requests in a given channel.
Any requests still waiting to be processed of the given channel, will be removed from the queue. Requests which are processed, but response handler is not called will also be removed.
channel | The type of request to be aborted |
Implements Ogre::WorkQueue.
|
virtualinherited |
Add a new request to the queue.
channel | The channel this request will go into = 0; the channel is the top-level categorisation of the request |
requestType | An identifier that's unique within this queue which identifies the type of the request (user decides the actual value) |
rData | The data required by the request process. |
retryCount | The number of times the request should be retried if it fails. |
forceSynchronous | Forces the request to be processed immediately even if threading is enabled. |
idleThread | Request should be processed on the idle thread. Idle requests will be processed on a single worker thread. You should use this in the following situations:
|
Implements Ogre::WorkQueue.
|
virtualinherited |
Add a request handler instance to the queue.
channel | The channel for requests you want to handle |
rh | Your handler |
Implements Ogre::WorkQueue.
|
protectedinherited |
Put a Request on the queue with a specific RequestID.
|
virtualinherited |
Add a response handler instance to the queue.
channel | The channel for responses you want to handle |
rh | Your handler |
Implements Ogre::WorkQueue.
Get a channel ID for a given channel name.
|
inherited |
Get the name of the work queue.
|
virtualinherited |
Returns whether requests are being accepted right now.
Implements Ogre::WorkQueue.
|
inlinevirtualinherited |
Get the time limit imposed on the processing of responses in a single frame, in milliseconds (0 indicates no limit).
Implements Ogre::WorkQueue.
Definition at line 455 of file OgreWorkQueue.h.
|
virtualinherited |
Get whether worker threads will be allowed to access render system resources.
Accessing render system resources from a separate thread can require that a context is maintained for that thread. Also, it requires that the render system is running in threadsafe mode, which only happens when OGRE_THREAD_SUPPORT=1. This option defaults to false, which means that threads can not use GPU resources, and the render system can work in non-threadsafe mode, which is more efficient.
|
virtualinherited |
Get the number of worker threads that this queue will start when startup() is called.
|
virtualinherited |
Return whether the queue is paused ie not sending more work to workers.
Implements Ogre::WorkQueue.
|
inlinevirtualinherited |
Returns whether the queue is trying to shut down.
Definition at line 422 of file OgreWorkQueue.h.
|
protectedvirtual |
Notify that a thread has registered itself with the render system.
|
protectedvirtual |
Notify workers about a new request.
Implements Ogre::DefaultWorkQueueBase.
|
protectedvirtual |
Notify workers about a new request.
Implements Ogre::DefaultWorkQueueBase.
|
protected |
Init notification mutex (must lock before waiting on initCondition)
|
private |
Synchronise registering threads with the RenderSystem.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
Synchroniser token to wait / notify on thread init.
|
protected |
|
inlineinherited |
Definition at line 96 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 102 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 108 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 113 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 119 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 68 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 73 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 79 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 86 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 91 of file OgreMemoryAllocatedObject.h.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
virtualinherited |
Process the responses in the queue.
Implements Ogre::WorkQueue.
|
virtualinherited |
Remove a request handler.
Implements Ogre::WorkQueue.
|
virtualinherited |
Remove a Response handler.
Implements Ogre::WorkQueue.
|
virtualinherited |
Set whether to pause further processing of any requests.
If true, any further requests will simply be queued and not processed until setPaused(false) is called. Any requests which are in the process of being worked on already will still continue.
Implements Ogre::WorkQueue.
|
virtualinherited |
Set whether to accept new requests or not.
If true, requests are added to the queue as usual. If false, requests are silently ignored until setRequestsAccepted(true) is called.
Implements Ogre::WorkQueue.
|
inlinevirtualinherited |
Set the time limit imposed on the processing of responses in a single frame, in milliseconds (0 indicates no limit).
This sets the maximum time that will be spent in processResponses() in a single frame. The default is 8ms.
Implements Ogre::WorkQueue.
Definition at line 457 of file OgreWorkQueue.h.
|
virtualinherited |
Set whether worker threads will be allowed to access render system resources.
Accessing render system resources from a separate thread can require that a context is maintained for that thread. Also, it requires that the render system is running in threadsafe mode, which only happens when OGRE_THREAD_SUPPORT=1. This option defaults to false, which means that threads can not use GPU resources, and the render system can work in non-threadsafe mode, which is more efficient. Calling this will have no effect unless the queue is shut down and restarted.
|
virtualinherited |
Set the number of worker threads that this queue will start when startup() is called (default 1).
Calling this will have no effect unless the queue is shut down and restarted.
|
virtual |
Shut down the queue.
Implements Ogre::WorkQueue.
|
virtual |
Shut down the queue.
Implements Ogre::WorkQueue.
|
virtual |
Start up the queue with the options that have been set.
forceRestart | If the queue is already running, whether to shut it down and restart. |
Implements Ogre::WorkQueue.
|
virtual |
Start up the queue with the options that have been set.
forceRestart | If the queue is already running, whether to shut it down and restart. |
Implements Ogre::WorkQueue.
|
protectedvirtual |
To be called by a separate thread; will return immediately if there are items in the queue, or suspend the thread until new items are added otherwise.
|
protectedinherited |
Definition at line 545 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 74 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 569 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 567 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 568 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 462 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 459 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 75 of file OgreWorkQueue.h.
|
protected |
Definition at line 66 of file OgreDefaultWorkQueueStandard.h.
|
protectedinherited |
Definition at line 544 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 468 of file OgreWorkQueue.h.
|
private |
Definition at line 71 of file OgreDefaultWorkQueueTBB.h.
|
protectedinherited |
Definition at line 543 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 541 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 467 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 542 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 469 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 463 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 546 of file OgreWorkQueue.h.
|
private |
Definition at line 68 of file OgreDefaultWorkQueueTBB.h.
|
private |
Definition at line 67 of file OgreDefaultWorkQueueTBB.h.
|
protectedinherited |
Definition at line 485 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 461 of file OgreWorkQueue.h.
|
protectedinherited |
Definition at line 460 of file OgreWorkQueue.h.