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::EBusSharedDispatchMutex Class Reference

#include <EBusSharedDispatchTraits.h>

Public Member Functions

void CallstackMutexLock ()
 
void CallstackMutexUnlock ()
 
void EventMutexLockExclusive ()
 
void EventMutexUnlockExclusive ()
 
void EventMutexLockShared ()
 
void EventMutexUnlockShared ()
 

Detailed Description

EBusSharedDispatchTraits is a custom mutex type and lock guards that can be used with an EBus to allow for parallel dispatch calls, but still prevents connects / disconnects during a dispatch.

Features:

  • Event dispatches can execute in parallel when called on separate threads
  • Bus connects / disconnects will only execute when no event dispatches are executing
  • Event dispatches can call other event dispatches on the same bus recursively

Limitations:

  • If the bus contains custom connect / disconnect logic, it must not call any event dispatches on the same bus.
  • Bus connects / disconnects cannot happen within event dispatches on the same bus.

Usage: To use the traits, inherit from EBusSharedDispatchTraits<BusType>: class MyBus : public AZ::EBusSharedDispatchTraits<MyBus>

Alternatively, you can directly define the specific traits via the following: using MutexType = AZ::EBusSharedDispatchMutex;

template <typename MutexType, bool IsLocklessDispatch> using DispatchLockGuard = AZ::EBusSharedDispatchMutexDispatchLockGuard<AZ::EBus<MyBus>>;

template<typename MutexType> using ConnectLockGuard = AZ::EBusSharedDispatchMutexConnectLockGuard<AZ::EBus<MyBus>>;

template<typename MutexType> using CallstackTrackerLockGuard = AZ::EBusSharedDispatchMutexCallstackLockGuard<AZ::EBus<MyBus>>;


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