Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::JobManager Class Reference

#include <JobManager.h>

Public Member Functions

AZ_CLASS_ALLOCATOR_DECL JobManager (const JobManagerDesc &desc)
 
AZ_FORCE_INLINE bool IsAsynchronous () const
 Check if we have multiple threads for parallel processing.
 
void ClearStats ()
 
void PrintStats ()
 
void CollectGarbage ()
 
JobGetCurrentJob ()
 
AZ::u32 GetNumWorkerThreads () const
 Returns number of active worker threads.
 
AZ::u32 GetWorkerThreadId () const
 Returns 0 based worker index (for legacy Job compatibility)
 

Static Public Attributes

static const AZ::u32 InvalidWorkerThreadId = Internal::JobManagerBase::InvalidWorkerThreadId
 

Friends

class Job
 

Detailed Description

JobManager continuously runs jobs as they become available. To create and run jobs use the Job class, JobManager should only be used to manage the threads which run the jobs.

The number of JobThreads created is controlled by JobManagerDesc. Note: as a debugging tool, one can temporarily force a JobContext to run all jobs synchronously by altering the provided JobManagerDesc to contain zero JobManagerThreadDesc. This is best done done on a per-JobContext basis. The default JobContect is created by the JobManagerComponent.

Member Function Documentation

◆ ClearStats()

void AZ::JobManager::ClearStats ( )
inline

Clears all accumulated statistics, should only really be called when system is idle to ensure consistent results.

◆ CollectGarbage()

void AZ::JobManager::CollectGarbage ( )
inline

Optionally call this to collect garbage from the work stealing deques, it absolutely MUST be only called when the system is idle. The garbage is bounded, to 100% of the deque memory, so don't call it at all if there is any doubt.

◆ GetCurrentJob()

Job * AZ::JobManager::GetCurrentJob ( )
inline

Returns the job which is currently running in this thread, if this is not a worker thread then NULL is returned.

◆ PrintStats()

void AZ::JobManager::PrintStats ( )
inline

Dumps accumulated statistics, should only really be called when system is idle to ensure consistent results.

Member Data Documentation

◆ InvalidWorkerThreadId

const AZ::u32 AZ::JobManager::InvalidWorkerThreadId = Internal::JobManagerBase::InvalidWorkerThreadId
static

Value returned by GetWorkerThreadId if the calling thread is not a worker thread in this JobContext.


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