Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
JobSystemWithBarrier Class Reference

#include <JobSystemWithBarrier.h>

Inheritance diagram for JobSystemWithBarrier:
JobSystem NonCopyable JobSystemThreadPool

Public Member Functions

JPH_OVERRIDE_NEW_DELETE JobSystemWithBarrier (uint inMaxBarriers)
 
 JobSystemWithBarrier ()=default
 
virtual ~JobSystemWithBarrier () override
 
void Init (uint inMaxBarriers)
 
virtual BarrierCreateBarrier () override
 Create a new barrier, used to wait on jobs.
 
virtual void DestroyBarrier (Barrier *inBarrier) override
 Destroy a barrier when it is no longer used. The barrier should be empty at this point.
 
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.
 
- Public Member Functions inherited from JobSystem
virtual ~JobSystem ()=default
 Destructor.
 
virtual int GetMaxConcurrency () const =0
 Get maximum number of concurrently executing jobs.
 
virtual JobHandle CreateJob (const char *inName, ColorArg inColor, const JobFunction &inJobFunction, uint32 inNumDependencies=0)=0
 
- 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.
 
- Protected Member Functions inherited from JobSystem
virtual void QueueJob (Job *inJob)=0
 Adds a job to the job queue.
 
virtual void QueueJobs (Job **inJobs, uint inNumJobs)=0
 Adds a number of jobs at once to the job queue.
 
virtual void FreeJob (Job *inJob)=0
 Frees a job.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ JobSystemWithBarrier() [1/2]

JobSystemWithBarrier::JobSystemWithBarrier ( uint  inMaxBarriers)
explicit

Constructs barriers

See also
JobSystemWithBarrier::Init

◆ JobSystemWithBarrier() [2/2]

JobSystemWithBarrier::JobSystemWithBarrier ( )
default

◆ ~JobSystemWithBarrier()

JobSystemWithBarrier::~JobSystemWithBarrier ( )
overridevirtual

Member Function Documentation

◆ CreateBarrier()

JobSystem::Barrier * JobSystemWithBarrier::CreateBarrier ( )
overridevirtual

Create a new barrier, used to wait on jobs.

Implements JobSystem.

◆ DestroyBarrier()

void JobSystemWithBarrier::DestroyBarrier ( Barrier inBarrier)
overridevirtual

Destroy a barrier when it is no longer used. The barrier should be empty at this point.

Implements JobSystem.

◆ Init()

void JobSystemWithBarrier::Init ( uint  inMaxBarriers)

Initialize the barriers

Parameters
inMaxBarriersMax number of barriers that can be allocated at any time

◆ WaitForJobs()

void JobSystemWithBarrier::WaitForJobs ( Barrier inBarrier)
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.


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