class WaitGroup

Inherits: INonCopyable

Provides an easy way to wait for N operations to complete executing.

Public

Constructors

WaitGroup

inline WaitGroup(u32 initialOperationCount = 0)

Methods

NotifyDone

inline bool NotifyDone()

Notifies the group that an operation completed executing.

If anything is waiting for the wait group, it will be unblocked if the operation count reached 0. Returns true if operation count reached 0.

Increment

inline void Increment(u32 count = 1)

Increments the operation count.

Wait

inline void Wait()

Blocks the caller until the operation count reaches 0.

Private

Fields

mMutex

Mutex mMutex

mSignal

Signal mSignal

mOperationCount

std::atomic<u32> mOperationCount