OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
Base for a general purpose task-based background work queue. More...
#include <OgreWorkQueue.h>
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. | |
void | addMainThreadTask (std::function< void()> task) override |
Add a deferred task that will be processed on the main render thread. | |
void | addTask (std::function< void()> task) override |
Add a new task to the queue. | |
const String & | getName () const |
Get the name of the work queue. | |
virtual bool | getRequestsAccepted () const override |
Returns whether requests are being accepted right now. | |
unsigned long | getResponseProcessingTimeLimit () const override |
virtual bool | getWorkersCanAccessRenderSystem () const |
Get whether worker threads will be allowed to access render system resources. | |
size_t | getWorkerThreadCount () const override |
Get the number of worker threads that this queue will start when startup() is called. | |
bool | isPaused () const override |
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 | processMainThreadTasks () override |
Process the tasks in the main-thread queue. | |
void | setPaused (bool pause) override |
Set whether to pause further processing of any requests. | |
void | setRequestsAccepted (bool accept) override |
Set whether to accept new requests or not. | |
void | setResponseProcessingTimeLimit (unsigned long ms) override |
virtual void | setWorkersCanAccessRenderSystem (bool access) |
Set whether worker threads will be allowed to access render system resources. | |
void | setWorkerThreadCount (size_t c) override |
Set the number of worker threads that this queue will start when startup() is called (default 1). | |
Public Member Functions inherited from Ogre::WorkQueue | |
WorkQueue () | |
virtual | ~WorkQueue () |
uint64 | getMainThreadProcessingTimeLimit () const |
Get the time limit imposed on the processing of tasks in a single frame, in milliseconds (0 indicates no limit). | |
virtual void | processResponses () |
void | setMainThreadProcessingTimeLimit (uint64 ms) |
Set the time limit imposed on the processing of tasks in a single frame, in milliseconds (0 indicates no limit). | |
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. | |
Additional Inherited Members | |
Public Types inherited from Ogre::WorkQueue | |
typedef unsigned long long int | RequestID |
Numeric identifier for a request. | |
Base for a general purpose task-based background work queue.
Ogre::DefaultWorkQueueBase::DefaultWorkQueueBase | ( | const String & | name = BLANKSTRING | ) |
Constructor.
Call startup() to initialise.
name | Optional name, just helps to identify logging output |
|
virtual |
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.
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.
Process the next request on the queue.
This method is public, but only intended for advanced users to call. The only reason you would call this, is if you were using your own thread to drive the worker processing. The thread calling this method will be the thread used to call the RequestHandler.
Main function for each thread spawned.
Implemented in Ogre::DefaultWorkQueue.
Returns whether the queue is trying to shut down.
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.
|
overridevirtual |
Return whether the queue is paused ie not sending more work to workers.
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.
Returns whether requests are being accepted right now.
Implements Ogre::WorkQueue.
|
overridevirtual |
Process the tasks in the main-thread queue.
This method must be called from the main render thread to 'pump' tasks through the system. The method will usually try to clear all tasks before returning; however, you can specify a time limit on the tasks processing to limit the impact of spikes in demand by calling setMainThreadProcessingTimeLimit.
Reimplemented from Ogre::WorkQueue.
|
inlineoverridevirtual |
Implements Ogre::WorkQueue.
|
inlineoverridevirtual |
Implements Ogre::WorkQueue.
|
inlineoverridevirtual |
Get the number of worker threads that this queue will start when startup() is called.
Reimplemented from Ogre::WorkQueue.
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.
Reimplemented from Ogre::WorkQueue.
Add a deferred task that will be processed on the main render thread.
Implements Ogre::WorkQueue.
Add a new task to the queue.
Implements Ogre::WorkQueue.