![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
#include <JobSystemWithBarrier.h>
Public Member Functions | |
| JPH_OVERRIDE_NEW_DELETE | JobSystemWithBarrier (uint inMaxBarriers) |
| JobSystemWithBarrier ()=default | |
| virtual | ~JobSystemWithBarrier () override |
| void | Init (uint inMaxBarriers) |
| virtual Barrier * | CreateBarrier () override |
| Create a new barrier, used to wait on jobs. More... | |
| virtual void | DestroyBarrier (Barrier *inBarrier) override |
| Destroy a barrier when it is no longer used. The barrier should be empty at this point. More... | |
| virtual void | WaitForJobs (Barrier *inBarrier) override |
| Wait for a set of jobs to be finished, note that only 1 thread can be waiting on a barrier at a time. More... | |
Public Member Functions inherited from JobSystem | |
| virtual | ~JobSystem ()=default |
| Destructor. More... | |
| virtual int | GetMaxConcurrency () const =0 |
| Get maximum number of concurrently executing jobs. More... | |
| virtual JobHandle | CreateJob (const char *inName, ColorArg inColor, const JobFunction &inJobFunction, uint32 inNumDependencies=0)=0 |
| virtual Barrier * | CreateBarrier ()=0 |
| Create a new barrier, used to wait on jobs. More... | |
| virtual void | DestroyBarrier (Barrier *inBarrier)=0 |
| Destroy a barrier when it is no longer used. The barrier should be empty at this point. More... | |
| virtual void | WaitForJobs (Barrier *inBarrier)=0 |
| Wait for a set of jobs to be finished, note that only 1 thread can be waiting on a barrier at a time. More... | |
Public Member Functions inherited from NonCopyable | |
| NonCopyable ()=default | |
| NonCopyable (const NonCopyable &)=delete | |
| void | operator= (const NonCopyable &)=delete |
Additional Inherited Members | |
Public Types inherited from JobSystem | |
| using | JobFunction = function< void()> |
| Main function of the job. More... | |
Protected Member Functions inherited from JobSystem | |
| virtual void | QueueJob (Job *inJob)=0 |
| Adds a job to the job queue. More... | |
| virtual void | QueueJobs (Job **inJobs, uint inNumJobs)=0 |
| Adds a number of jobs at once to the job queue. More... | |
| virtual void | FreeJob (Job *inJob)=0 |
| Frees a job. More... | |
Implementation of the Barrier class for a JobSystem
This class can be used to make it easier to create a new JobSystem implementation that integrates with your own job system. It will implement all functionality relating to barriers, so the only functions that are left to be implemented are:
See instructions in JobSystem for more information on how to implement these.
|
explicit |
Constructs barriers
|
default |
|
overridevirtual |
|
overridevirtual |
Create a new barrier, used to wait on jobs.
Implements JobSystem.
|
overridevirtual |
Destroy a barrier when it is no longer used. The barrier should be empty at this point.
Implements JobSystem.
| void JobSystemWithBarrier::Init | ( | uint | inMaxBarriers | ) |
Initialize the barriers
| inMaxBarriers | Max number of barriers that can be allocated at any time |
|
overridevirtual |
Wait for a set of jobs to be finished, note that only 1 thread can be waiting on a barrier at a time.
Implements JobSystem.