![]() |
Gaia-ECS v0.9.3
A simple and powerful entity component system
|
Public Member Functions | |
| void | make_main_thread () |
| Make the calling thread the effective main thread from the thread pool perspective. | |
| GAIA_NODISCARD uint32_t | workers () const |
| Returns the number of worker threads. | |
| void | set_max_workers (uint32_t count, uint32_t countHighPrio) |
| Set the maximum number of workers for this system. | |
| void | set_workers_high_prio_inter (uint32_t &workerIdx, uint32_t count) |
| Updates the number of worker threads participating at high priority workloads. | |
| void | set_workers_low_prio_inter (uint32_t &workerIdx, uint32_t count) |
| Updates the number of worker threads participating at low priority workloads. | |
| void | set_workers_high_prio (uint32_t count) |
| Updates the number of worker threads participating at high priority workloads. | |
| void | set_workers_low_prio (uint32_t count) |
| Updates the number of worker threads participating at low priority workloads. | |
| void | dep (JobHandle jobFirst, JobHandle jobSecond) |
| Makes jobSecond depend on jobFirst. This means jobSecond will not run until jobFirst finishes. | |
| void | dep (std::span< JobHandle > jobsFirst, JobHandle jobSecond) |
| Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish. | |
| void | dep_refresh (JobHandle jobFirst, JobHandle jobSecond) |
| Makes jobSecond depend on jobFirst. This means jobSecond will not run until jobFirst finishes. | |
| void | dep_refresh (std::span< JobHandle > jobsFirst, JobHandle jobSecond) |
| Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish. | |
| template<typename TJob > | |
| JobHandle | add (TJob &&job) |
| Creates a threadpool job from job. | |
| void | del (JobHandle jobHandle) |
| Deletes a job handle jobHandle from the threadpool. | |
| void | submit (std::span< JobHandle > jobHandles) |
| Pushes jobHandles into the internal queue so worker threads can pick them up and execute them. If there are more jobs than the queue can handle it puts the calling thread to sleep until workers consume enough jobs. | |
| void | submit (JobHandle jobHandle) |
| Pushes jobHandle into the internal queue so worker threads can pick it up and execute it. If there are more jobs than the queue can handle it puts the calling thread to sleep until workers consume enough jobs. | |
| void | reset_state (std::span< JobHandle > jobHandles) |
| void | reset_state (JobHandle jobHandle) |
| JobHandle | sched (Job &job) |
| Schedules a job to run on a worker thread. | |
| JobHandle | sched (Job &job, JobHandle dependsOn) |
| Schedules a job to run on a worker thread. | |
| JobHandle | sched_par (JobParallel &job, uint32_t itemsToProcess, uint32_t groupSize) |
| Schedules a job to run on worker threads in parallel. | |
| void | wait (JobHandle jobHandle) |
| Wait until a job associated with the jobHandle finishes executing. Cleans up any job allocations and dependencies associated with jobHandle The calling thread participate in job processing until jobHandle is done. | |
| void | update () |
| Uses the main thread to help with jobs processing. | |
Static Public Member Functions | |
| static ThreadPool & | get () |
| static GAIA_NODISCARD uint32_t | hw_thread_cnt () |
| Returns the number of HW threads available on the system. 1 is minimum. | |
| static GAIA_NODISCARD uint32_t | hw_efficiency_cores_cnt () |
| Returns the number of efficiency cores of the system. | |
Friends | |
| class | JobManager |
|
inline |
Creates a threadpool job from job.
|
inline |
Deletes a job handle jobHandle from the threadpool.
Makes jobSecond depend on jobFirst. This means jobSecond will not run until jobFirst finishes.
| jobFirst | The job that must complete first. |
| jobSecond | The job that will run after jobFirst. |
Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish.
| jobsFirst | Jobs that must complete first. |
| jobSecond | The job that will run after jobsFirst. |
Makes jobSecond depend on jobFirst. This means jobSecond will not run until jobFirst finishes.
| jobFirst | The job that must complete first. |
| jobSecond | The job that will run after jobFirst. |
|
inline |
Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish.
| jobsFirst | Jobs that must complete first. |
| jobSecond | The job that will run after jobsFirst. |
|
inlinestatic |
Returns the number of efficiency cores of the system.
|
inlinestatic |
Returns the number of HW threads available on the system. 1 is minimum.
|
inline |
Schedules a job to run on worker threads in parallel.
| job | Job descriptor |
| itemsToProcess | Total number of work items |
| groupSize | Group size per created job. If zero the threadpool decides the group size. |
|
inline |
Set the maximum number of workers for this system.
| count | Requested number of worker threads to create. |
| countHighPrio | HighPrio Number of high-priority workers to create. Calculated as Max(count, countHighPrio). |
|
inline |
Updates the number of worker threads participating at high priority workloads.
|
inline |
Updates the number of worker threads participating at high priority workloads.
| [out] | workerIdx | Number of high priority workers. |
| count | Requested number of high priority workers. |
|
inline |
Updates the number of worker threads participating at low priority workloads.
|
inline |
Updates the number of worker threads participating at low priority workloads.
| [out] | workerIdx | Number of low priority workers. |
| count | Requested number of low priority workers. |
|
inline |
Pushes jobHandle into the internal queue so worker threads can pick it up and execute it. If there are more jobs than the queue can handle it puts the calling thread to sleep until workers consume enough jobs.
Pushes jobHandles into the internal queue so worker threads can pick them up and execute them. If there are more jobs than the queue can handle it puts the calling thread to sleep until workers consume enough jobs.