|
Axmol 3.0.0-89d6d9a
|
Thread-pool based background job system used by Axmol. More...
#include <JobSystem.h>
Public Member Functions | |
| JobHandle | enqueue (std::function< void()> jobFunc) |
| Enqueue a regular background job. | |
| JobHandle | enqueue (std::function< void(JobThreadData *)> jobFunc) |
| Enqueue a job that receives the worker thread's JobThreadData. | |
| int | getWorkerCount () const |
| Get the number of worker threads owned by this JobSystem. | |
Thread-pool based background job system used by Axmol.
JobSystem owns a small worker pool and executes submitted jobs off the Axmol thread when worker threads are available. If the platform or configuration creates the JobSystem with no workers, jobs run synchronously on the caller thread with a main-thread JobThreadData fallback.
The preferred entry point is enqueue(std::function<void()>). Use enqueue(std::function<void(JobThreadData*)>) only when a job needs per-worker context initialized by JobThreadData.
| JobHandle enqueue | ( | std::function< void()> | jobFunc | ) |
Enqueue a regular background job.
This is the default overload for fire-and-forget work. Keep the returned handle only when native code needs to observe completion, wait for the job, or request cooperative cancellation.
| jobFunc | Function executed by the JobSystem. |
| JobHandle enqueue | ( | std::function< void(JobThreadData *)> | jobFunc | ) |
Enqueue a job that receives the worker thread's JobThreadData.
Use this overload for jobs that need per-worker context initialized by JobThreadData::init(), such as renderer, decoder, or platform resources that should be reused by a worker thread.
| jobFunc | Function executed by the JobSystem. In the synchronous fallback path, it receives the main-thread JobThreadData instance. |
|
inline |