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. 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 BarrierCreateBarrier ()=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...
 

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: