Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::mt::JobManager Class Reference

Public Member Functions

JobContainerdata (JobHandle jobHandle)
 
const JobContainerdata (JobHandle jobHandle) const
 
GAIA_NODISCARD JobHandle alloc_job (const Job &job)
 Allocates a new job container identified by a unique JobHandle.
 
void free_job (JobHandle jobHandle)
 Invalidates jobHandle by resetting its index in the job pool. Every time a job is deallocated its generation is increased by one.
 
void reset ()
 Resets the job pool.
 
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 (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.
 
GAIA_NODISCARD bool is_clear (JobHandle jobHandle) const
 

Static Public Member Functions

static void run (JobContainer &jobData)
 Execute the functor associated with the job container.
 
static bool signal_edge (JobContainer &jobData)
 
static void free_edges (JobContainer &jobData)
 
static uint32_t submit (JobContainer &jobData)
 
static void processing (JobContainer &jobData)
 
static void executing (JobContainer &jobData, uint32_t workerIdx)
 
static void finalize (JobContainer &jobData)
 
static void reset_state (JobContainer &jobData)
 
static GAIA_NODISCARD bool is_clear (JobContainer &jobData)
 
static GAIA_NODISCARD bool submitted (const JobContainer &jobData)
 
static GAIA_NODISCARD bool processing (const JobContainer &jobData)
 
static GAIA_NODISCARD bool busy (const JobContainer &jobData)
 
static GAIA_NODISCARD bool done (const JobContainer &jobData)
 

Member Function Documentation

◆ alloc_job()

GAIA_NODISCARD JobHandle gaia::mt::JobManager::alloc_job ( const Job job)
inline

Allocates a new job container identified by a unique JobHandle.

Returns
JobHandle
Warning
Must be used from the main thread.

◆ dep() [1/2]

void gaia::mt::JobManager::dep ( JobHandle  jobFirst,
JobHandle  jobSecond 
)
inline

Makes jobSecond depend on jobFirst. This means jobSecond will not run until jobFirst finishes.

Parameters
jobFirstThe job that must complete first.
jobSecondThe job that will run after jobFirst.
Warning
This must be called before any of the listed jobs are scheduled.

◆ dep() [2/2]

void gaia::mt::JobManager::dep ( std::span< JobHandle jobsFirst,
JobHandle  jobSecond 
)
inline

Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish.

Parameters
jobsFirstJobs that must complete first.
jobSecondThe job that will run after jobsFirst.
Warning
This must must to be called before any of the listed jobs are scheduled.

◆ dep_refresh()

void gaia::mt::JobManager::dep_refresh ( std::span< JobHandle jobsFirst,
JobHandle  jobSecond 
)
inline

Makes jobSecond depend on the jobs listed in jobsFirst. This means jobSecond will not run until all jobs from jobsFirst finish.

Parameters
jobsFirstJobs that must complete first.
jobSecondThe job that will run after jobsFirst.
Note
Unlike dep() this function needs to be called when job handles are reused.
Warning
This must be called before any of the listed jobs are scheduled.

◆ free_job()

void gaia::mt::JobManager::free_job ( JobHandle  jobHandle)
inline

Invalidates jobHandle by resetting its index in the job pool. Every time a job is deallocated its generation is increased by one.

Parameters
jobHandleJob handle.
Warning
Must be used from the main thread.

◆ run()

static void gaia::mt::JobManager::run ( JobContainer jobData)
inlinestatic

Execute the functor associated with the job container.

Parameters
jobDataContainer with internal job specific data

The documentation for this class was generated from the following file: