![]() |
Shkyera Engine
Easy to use, game engine for Python
|
#include <JobSystem.hpp>
Classes | |
struct | Job |
class | JobBuilder |
Public Member Functions | |
JobExecutor | pull () |
void | wait () |
Static Public Member Functions | |
static JobSystem & | getInstance () |
Private Types | |
enum class | JobStatus : uint8_t { PENDING , RUNNING , DONE } |
Private Member Functions | |
JobSystem ()=default | |
JobHandle | submit (Job &&job) |
bool | isScheduled (JobHandle handle) const |
std::optional< JobHandle > | getJob () |
void | markJobAsDone (JobHandle handle) |
Private Attributes | |
std::mutex | _mutex |
std::condition_variable | _cv |
JobHandle | _nextJobHandle |
TypeSet | _resourcesRead |
TypeSet | _resourcesWritten |
SparseSet< Job > | _jobs |
Friends | |
class | SparseSet< Job > |
Singleton class managing job scheduling and execution. Provides a thread-safe job system for parallel task execution with resource dependencies. Jobs can be configured with dependencies, resource requirements, and thread affinity.
|
strongprivate |
|
privatedefault |
|
static |
Gets the singleton instance of the job system. This is the only way to access the job system instance.
|
private |
Gets the next available job that can be executed. A job is available if all its dependencies are satisfied and its resource requirements don't conflict with currently running jobs.
Checks if a job is currently scheduled in the system. A job is considered scheduled if it has been submitted and the user did not wait() for all jobs to complete.
handle | The job handle to check |
Marks a job as completed and updates resource states. This will release any resources that were being used by the job.
handle | The handle of the completed job |
JobExecutor shkyera::JobSystem::pull | ( | ) |
Pulls the next available job for execution.
Submits a job to the system for execution. The job will be scheduled based on its dependencies and resource requirements.
job | The job to be submitted |
void shkyera::JobSystem::wait | ( | ) |
Waits for all scheduled jobs to complete. This method blocks until all jobs in the system have finished execution.
|
private |
|
private |
|
private |
|
private |
|
private |