#include <JobCompletionSpin.h>
Inherits AZ::Job.
Public Member Functions | |
AZ_CLASS_ALLOCATOR (JobCompletionSpin, ThreadPoolAllocator) | |
JobCompletionSpin (JobContext *context=nullptr) | |
void | StartAndWaitForCompletion () |
virtual void | Reset (bool isClearDependent) |
Public Member Functions inherited from AZ::Job | |
Job (bool isAutoDelete, JobContext *context, bool isCompletion=false, AZ::s8 priority=0) | |
void | Start () |
virtual void | Reset (bool isClearDependent) |
void | SetDependent (Job *dependent) |
void | SetDependentStarted (Job *dependent) |
void | SetContinuation (Job *continuationJob) |
void | StartAsChild (Job *childJob) |
void | WaitForChildren () |
bool | IsCancelled () const |
bool | IsAutoDelete () const |
bool | IsCompletion () const |
void | StartAndAssistUntilComplete () |
void | StartAndWaitForCompletion () |
JobContext * | GetContext () const |
Job * | GetDependent () const |
unsigned int | GetDependentCount () const |
void | IncrementDependentCount () |
void | DecrementDependentCount () |
AZ::s8 | GetPriority () const |
Protected Member Functions | |
virtual void | Process () |
Override to implement your processing. | |
Protected Member Functions inherited from AZ::Job | |
virtual void | Process ()=0 |
Override to implement your processing. | |
void | StoreDependent (Job *job) |
void | SetDependentChild (Job *dependent) |
void | IncrementDependentCountAndSetChildFlag () |
void | SetDependentCountAndFlags (unsigned int countAndFlags) |
unsigned int | GetDependentCountAndFlags () const |
Protected Attributes | |
AZStd::spin_mutex | m_mutex |
Protected Attributes inherited from AZ::Job | |
JobContext *volatile | m_context |
AZStd::atomic< unsigned int > | m_dependentCountAndFlags |
AZStd::atomic< Job * > | m_dependent |
int | m_state |
Additional Inherited Members | |
Public Types inherited from AZ::Job | |
enum | State { STATE_SETUP , STATE_STARTED , STATE_PENDING , STATE_PROCESSING , STATE_SUSPENDED } |
Job which allows caller to block until it is completed using spin lock. This should be in special cases where the jobs are super short and semaphore creation is too expensive. IMPORTANT: Don't use JobCompletionSpin by default, use JobCompletion! This class is provided only for special cases. You should always verify with profiling that is it actually faster when you use it, as spins (mutex or jobs) introduce a whole new set of problems.
|
inlineprotectedvirtual |
Override to implement your processing.
Implements AZ::Job.
|
inlinevirtual |
Resets a non-auto-deleting job so it can be used again. If the dependent is not cleared, then it should be already in the reset state, in order to increment the dependent count.
Reimplemented from AZ::Job.
|
inline |
Call this function to start the job and block until the job has been completed.