![]() |
OGRE 14.6
Object-Oriented Graphics Rendering Engine
|
Threaded implementation of a general purpose task-based background work queue. More...
#include <OgreDefaultWorkQueue.h>
Public Member Functions | |
| DefaultWorkQueue (const String &name=BLANKSTRING) | |
| virtual | ~DefaultWorkQueue () |
| void | _threadMain () override |
| Worker thread loop. | |
| void | shutdown () override |
| Stop and join all worker threads. | |
| void | startup (bool forceRestart=true) override |
| Start the worker threads. | |
| Public Member Functions inherited from Ogre::DefaultWorkQueueBase | |
| DefaultWorkQueueBase (const String &name=BLANKSTRING) | |
| Constructor. | |
| virtual | ~DefaultWorkQueueBase () |
| virtual void | _processNextRequest () |
| Pop and execute the next task from the background queue. | |
| void | addMainThreadTask (std::function< void()> task) override |
| Add a task that will be processed on the main render thread. | |
| void | addTask (std::function< void()> task) override |
| Add a new task to the background queue. | |
| const String & | getName () const |
| Get the name of the work queue. | |
| virtual bool | getRequestsAccepted () const override |
| Returns whether tasks 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 tasks. | |
| void | setRequestsAccepted (bool accept) override |
| Set whether to accept new tasks 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). | |
Additional Inherited Members | |
| Public Types inherited from Ogre::WorkQueue | |
| typedef unsigned long long int | RequestID |
| Legacy identifier type of the request/response API. | |
Threaded implementation of a general purpose task-based background work queue.
This implementation starts a pool of worker threads on startup and provides the FIFO queues for background and main-thread tasks. Worker threads are named [Ogre] Worker where the platform supports it.
| Ogre::DefaultWorkQueue::DefaultWorkQueue | ( | const String & | name = BLANKSTRING | ) |
References Ogre::BLANKSTRING.
|
virtual |
|
overridevirtual |
Worker thread loop.
Waits for tasks and executes them until shutdown is requested. With workers allowed to access the render system, the thread registers itself before entering the loop.
Implements Ogre::DefaultWorkQueueBase.
|
overridevirtual |
Stop and join all worker threads.
Tasks that are already running are allowed to finish. Tasks still waiting in the queues are not executed and are left in the queues, so they may run if the queue is started again before it is destroyed. The destructor calls this method.
Implements Ogre::WorkQueue.
|
overridevirtual |
Start the worker threads.
| forceRestart | If the queue is already running, shut it down first. Otherwise this is a no-op while running. |
Implements Ogre::WorkQueue.