EntityComponentMetaSystem
An implementation of an EntityComponent System with template meta-programming.
|
Implementation of a Thread Pool. More...
#include <ThreadPool.hpp>
Public Member Functions | |
void | queueFn (std::function< void(void *)> &&fn, void *ud=nullptr) |
Queues a function to be called (doesn't start calling yet). More... | |
Internal::PointersT | startThreads () |
Creates MAXSIZE threads that will process queueFn() functions. More... | |
bool | isQueueEmpty () |
Returns true if the function queue is empty. | |
constexpr unsigned int | getMaxThreadCount () |
Returns the MAXSIZE count that this class was created with. | |
void | easyStartAndWait () |
Calls startThreads() and waits until all threads have finished. More... | |
bool | isNotRunning () |
Checks if any threads are currently running, returning true if there are no threads running. | |
Implementation of a Thread Pool.
Note that MAXSIZE template parameter determines how many threads are created each time that startThreads() (or easyStartAndWait()) is called.
|
inline |
Calls startThreads() and waits until all threads have finished.
Regardless of the value set to MAXSIZE, this function will block until all previously queued functions have been executed.
|
inline |
Queues a function to be called (doesn't start calling yet).
To run the queued functions, startThreads() must be called to wake the waiting threads which will start pulling functions from the queue to be called.
Note that the easyStartAndWait() calls startThreads() and waits until the threads have finished execution.
|
inline |
Creates MAXSIZE threads that will process queueFn() functions.
Note that if MAXSIZE < 2, then this function will synchronously execute the queued functions and block until the functions have been executed. Otherwise, this function may return before the queued functions have been executed.