OGRE 2.1
Object-Oriented Graphics Rendering Engine
|
Base for a general purpose request / response style background work queue. More...
#include <OgreWorkQueue.h>
Public Types | |
typedef unsigned long long int | RequestID |
Numeric identifier for a request. | |
Public Member Functions | |
DefaultWorkQueueBase (const String &name=BLANKSTRING) | |
Constructor. | |
virtual | ~DefaultWorkQueueBase () |
virtual void | _processNextRequest () |
Process the next request on the queue. | |
virtual void | _threadMain ()=0 |
Main function for each thread spawned. | |
virtual void | abortAllRequests () |
Abort all previously issued requests. | |
virtual void | abortPendingRequestsByChannel (uint16 channel) |
Abort all previously issued requests in a given channel. | |
virtual void | abortRequest (RequestID id) |
Abort a previously issued request. | |
virtual void | abortRequestsByChannel (uint16 channel) |
Abort all previously issued requests in a given channel. | |
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. | |
virtual void | addRequestHandler (uint16 channel, RequestHandler *rh) |
Add a request handler instance to the queue. | |
virtual void | addResponseHandler (uint16 channel, ResponseHandler *rh) |
Add a response handler instance to the queue. | |
virtual uint16 | getChannel (const String &channelName) |
Get a channel ID for a given channel name. | |
const String & | getName () const |
Get the name of the work queue. | |
virtual bool | getRequestsAccepted () const |
Returns whether requests are being accepted right now. | |
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). | |
virtual bool | getWorkersCanAccessRenderSystem () const |
Get whether worker threads will be allowed to access render system resources. | |
virtual size_t | getWorkerThreadCount () const |
Get the number of worker threads that this queue will start when startup() is called. | |
virtual bool | isPaused () const |
Return whether the queue is paused ie not sending more work to workers. | |
virtual bool | isShuttingDown () const |
Returns whether the queue is trying to shut down. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info | |
void * | operator new (size_t sz, void *ptr) |
placement operator new | |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info | |
virtual void | processResponses () |
Process the responses in the queue. | |
virtual void | removeRequestHandler (uint16 channel, RequestHandler *rh) |
Remove a request handler. | |
virtual void | removeResponseHandler (uint16 channel, ResponseHandler *rh) |
Remove a Response handler. | |
virtual void | setPaused (bool pause) |
Set whether to pause further processing of any requests. | |
virtual void | setRequestsAccepted (bool accept) |
Set whether to accept new requests or not. | |
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). | |
virtual void | setWorkersCanAccessRenderSystem (bool access) |
Set whether worker threads will be allowed to access render system resources. | |
virtual void | setWorkerThreadCount (size_t c) |
Set the number of worker threads that this queue will start when startup() is called (default 1). | |
virtual void | shutdown ()=0 |
Shut down the queue. | |
virtual void | startup (bool forceRestart=true)=0 |
Start up the queue with the options that have been set. | |
Base for a general purpose request / response style background work queue.
Numeric identifier for a request.
Ogre::DefaultWorkQueueBase::DefaultWorkQueueBase | ( | const String & | name = BLANKSTRING | ) |
Constructor.
Call startup() to initialise.
name | Optional name, just helps to identify logging output |
|
virtual |
Process the next request on the queue.
Main function for each thread spawned.
Implemented in Ogre::DefaultWorkQueue, and Ogre::DefaultWorkQueue.
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.
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.
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.
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.
|
virtual |
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.
|
virtual |
Add a request handler instance to the queue.
channel | The channel for requests you want to handle |
rh | Your handler |
Implements Ogre::WorkQueue.
|
virtual |
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.
Returns whether requests are being accepted right now.
Implements Ogre::WorkQueue.
|
inlinevirtual |
Get the time limit imposed on the processing of responses in a single frame, in milliseconds (0 indicates no limit).
Implements Ogre::WorkQueue.
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.
Get the number of worker threads that this queue will start when startup() is called.
Return whether the queue is paused ie not sending more work to workers.
Implements Ogre::WorkQueue.
Returns whether the queue is trying to shut down.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
placement operator new
|
inlineinherited |
|
inlineinherited |
array operator new, with debug line info
Process the responses in the queue.
Implements Ogre::WorkQueue.
|
virtual |
Remove a request handler.
Implements Ogre::WorkQueue.
|
virtual |
Remove a Response handler.
Implements Ogre::WorkQueue.
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.
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.
|
inlinevirtual |
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.
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.
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.
Shut down the queue.
Implemented in Ogre::DefaultWorkQueue, and Ogre::DefaultWorkQueue.
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. |
Implemented in Ogre::DefaultWorkQueue, and Ogre::DefaultWorkQueue.