|
CeresEngine 0.2.0
A game development framework
|
The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads. More...
#include <CeresEngine/Foundation/Threading/ThreadPool.hpp>
Public Types | |
| using | Executor = Super::executor_type |
Public Types inherited from CeresEngine::ExecutionContext | |
| using | ID = id |
| using | executor_type = AnyExecutor |
Public Member Functions | |
| AnyExecutor | getExecutor () noexcept override |
| Returns an executor that run execute scheduled commands on the context. | |
Public Member Functions inherited from CeresEngine::ExecutionContext | |
| virtual | ~ExecutionContext () noexcept=default |
| Virtual destructor for the execution context object. | |
| template<typename T > | |
| bool | hasService () noexcept |
Determine if the ExecutionContext contains the specified service type. | |
| template<typename T > | |
| T & | getService () noexcept |
| Obtain the service object corresponding to the given type. | |
| template<typename T > | |
| T * | getServiceIf () noexcept |
| Obtain the service object corresponding to the given type. | |
| executor_type | get_executor () noexcept |
| Returns an executor that run execute scheduled commands on the context. | |
| bool | isActive () const noexcept |
| Checks if the execution context is currently active. | |
Private Types | |
| using | Super = asio::thread_pool |
Additional Inherited Members | |
Static Public Member Functions inherited from CeresEngine::ExecutionContext | |
| static ExecutionContext * | getCurrent () noexcept |
| Gets the current execution context, if any is active. | |
| static ExecutionContext & | get () noexcept |
| Gets the current execution context, if any is active. | |
The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads.
To submit functions to the thread pool, use the dispatch(), post() or defer() free functions.
For example:
| using CeresEngine::ThreadPool::Executor = Super::executor_type |
|
private |
|
inlineoverridevirtualnoexcept |
Returns an executor that run execute scheduled commands on the context.
Implements CeresEngine::ExecutionContext.