40 void Init(
uint inMaxJobs,
uint inMaxBarriers,
int inNumThreads = -1);
47 void SetNumThreads(
int inNumThreads) { StopThreads(); StartThreads(inNumThreads); }
51 virtual void QueueJob(Job *inJob)
override;
52 virtual void QueueJobs(Job **inJobs,
uint inNumJobs)
override;
53 virtual void FreeJob(Job *inJob)
override;
57 void StartThreads(
int inNumThreads);
61 void ThreadMain(
int inThreadIndex);
64 inline uint GetHead()
const;
67 inline void QueueJobInternal(Job *inJob);
77 static constexpr uint32 cQueueLength = 1024;
79 atomic<Job *> mQueue[cQueueLength];
82 atomic<uint> * mHeads =
nullptr;
89 atomic<bool> mQuit =
false;
#define JPH_EXPORT
Definition: Core.h:227
#define JPH_CACHE_LINE_SIZE
Definition: Core.h:466
#define JPH_SUPPRESS_WARNINGS_STD_BEGIN
Definition: Core.h:372
#define JPH_SUPPRESS_WARNINGS_STD_END
Definition: Core.h:384
unsigned int uint
Definition: Core.h:439
#define JPH_NAMESPACE_END
Definition: Core.h:367
std::uint32_t uint32
Definition: Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
constexpr bool IsPowerOf2(T inV)
Check if inV is a power of 2.
Definition: Math.h:73
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
std::vector< T, STLAllocator< T > > Array
Definition: STLAllocator.h:81
Class that holds an RGBA color with 8-bits per component.
Definition: Color.h:16
Definition: FixedSizeFreeList.h:18
Definition: JobSystem.h:80
virtual JobHandle CreateJob(const char *inName, ColorArg inColor, const JobFunction &inJobFunction, uint32 inNumDependencies=0)=0
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.
virtual void QueueJob(Job *inJob)=0
Adds a job to the job queue.
Definition: JobSystemThreadPool.h:26
void SetNumThreads(int inNumThreads)
Change the max concurrency after initialization.
Definition: JobSystemThreadPool.h:47
JobSystemThreadPool()=default
virtual int GetMaxConcurrency() const override
Get maximum number of concurrently executing jobs.
Definition: JobSystemThreadPool.h:43
Definition: JobSystemWithBarrier.h:24
void Init(uint inMaxBarriers)
Definition: JobSystemWithBarrier.cpp:167
Definition: Semaphore.h:23