245 return this == &context;
Task: an operation that can be executed by multiple threads in parallel.
An event listener (bunch of callbacks)
virtual void taskFail(PoolIndex pool, AbstractTask &task, const std::exception &ex)=0
Called when a task fails.
virtual void gpuInitFail(PoolIndex pool, const std::exception &ex)=0
Called when GPU initialization failed.
virtual void threadCreated(PoolIndex pool)=0
Called when a new worker thread is created.
virtual void threadTerminating(PoolIndex pool)=0
Called when a worker thread finished.
virtual bool taskDone(PoolIndex pool, AbstractTask &task, bool aborted)=0
Called when a task is successfully finished.
Basic class: task and memory management, any kind of static data.
static const PoolIndex DEFAULT_POOL
const ThreadIndex maxAllowedWorkerCount(const PoolIndex pool=DEFAULT_POOL) const
GL::RecycleBin * recycleBin
stores GPU garbage: resources managed by GPU and might be freed in the managing thread only
float performTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Performs a given task.
void wait(const PoolIndex pool=DEFAULT_POOL)
Blocks until all the submitted jobs are executed.
Job submitTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Adds a new task to the jobs queue.
bool operator==(const Context &context) const
Context comparaison operator Two different instances of contexts are basically never identical; retur...
bool abortJob(Job job, const PoolIndex pool=DEFAULT_POOL)
Aborts a given submitted job.
GL::RecycleBin * getGpuRecycleBin() const
bool isManagingThread() const
Job submitPersistentTask(AbstractTask &task, const PoolIndex pool=DEFAULT_POOL)
Adds a new persistent task to the jobs queue.
bool queryGpuInfo(std::string &vendor, std::string &renderer)
Initializes the GPU if not yet and queries information about it.
void check(const PoolIndex pool=DEFAULT_POOL)
Checks if a specific thread pool is doing great: rethrows exceptions occurred during tasks execution,...
EventListener * getEventListener() const
Returns current event listener (or NULL)
Context(const Context &)=delete
disabling copying constructor
bool busy(const PoolIndex pool=DEFAULT_POOL)
Queries whether a given thread pool is busy with a task.
void repeatTask(AbstractTask &task, bool abortCurrent, const PoolIndex pool=DEFAULT_POOL)
Ensures a given task executed at least once.
void warmUpGpu()
Initializes GPU within a given Context if not yet (takes no effect if it already is).
bool isGpuQueried() const
void limitWorkerCount(ThreadIndex maxValue, const PoolIndex pool=DEFAULT_POOL)
Limits maximum number of threads (workers) when performing tasks in a given pool.
void setEventListener(EventListener *eventListener)
Installs new event listener.
void waitForJob(Job job, const PoolIndex pool=DEFAULT_POOL)
Waits until a given job finishes.
Stores references to GPU resources that will not be used anymore and needed to be recycled in a threa...
Beatmup object base class
Context class implementation (pimpl)
unsigned char ThreadIndex
number of threads / thread index
unsigned char PoolIndex
number of tread pools or a pool index
JNIEnv jlong jint jint job
Beatmup::SceneRenderer * renderer
Beatmup::NNets::InferenceTask * task