#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
#define JPH_IF_ENABLE_ASSERTS(...)
Definition: IssueReporting.h:35
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition: BodyID.h:13
Base class interface for locking a body. Usually you will use BodyLockRead / BodyLockWrite / BodyLock...
Definition: BodyLockInterface.h:17
virtual void UnlockRead(SharedMutex *inMutex) const =0
BodyManager & mBodyManager
Definition: BodyLockInterface.h:53
virtual MutexMask GetMutexMask(const BodyID *inBodies, int inNumber) const =0
BodyLockInterface(BodyManager &inBodyManager)
Constructor.
Definition: BodyLockInterface.h:23
Body * TryGetBody(const BodyID &inBodyID) const
Convert body ID to body.
Definition: BodyLockInterface.h:50
virtual void UnlockRead(MutexMask inMutexMask) const =0
MutexMask GetAllBodiesMutexMask() const
Get the mask needed to lock all bodies.
Definition: BodyLockInterface.h:35
BodyManager::MutexMask MutexMask
Redefine MutexMask.
Definition: BodyLockInterface.h:20
virtual void UnlockWrite(SharedMutex *inMutex) const =0
virtual SharedMutex * LockRead(const BodyID &inBodyID) const =0
virtual void LockWrite(MutexMask inMutexMask) const =0
virtual SharedMutex * LockWrite(const BodyID &inBodyID) const =0
virtual ~BodyLockInterface()=default
virtual void LockRead(MutexMask inMutexMask) const =0
virtual void UnlockWrite(MutexMask inMutexMask) const =0
Implementation that uses the body manager to lock the correct mutex for a body.
Definition: BodyLockInterface.h:78
virtual void UnlockWrite(SharedMutex *inMutex) const override
Definition: BodyLockInterface.h:102
virtual SharedMutex * LockWrite(const BodyID &inBodyID) const override
Definition: BodyLockInterface.h:95
virtual void UnlockRead(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:118
virtual void UnlockWrite(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:128
virtual void LockWrite(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:123
virtual void UnlockRead(SharedMutex *inMutex) const override
Definition: BodyLockInterface.h:90
virtual SharedMutex * LockRead(const BodyID &inBodyID) const override
Definition: BodyLockInterface.h:83
virtual MutexMask GetMutexMask(const BodyID *inBodies, int inNumber) const override
Definition: BodyLockInterface.h:108
virtual void LockRead(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:113
Implementation that performs no locking (assumes the lock has already been taken)
Definition: BodyLockInterface.h:58
virtual void LockWrite(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:72
virtual MutexMask GetMutexMask(const BodyID *inBodies, int inNumber) const override
Definition: BodyLockInterface.h:69
virtual void UnlockRead(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:71
virtual SharedMutex * LockRead(const BodyID &inBodyID) const override
Definition: BodyLockInterface.h:63
virtual void UnlockWrite(SharedMutex *inMutex) const override
Definition: BodyLockInterface.h:66
virtual SharedMutex * LockWrite(const BodyID &inBodyID) const override
Definition: BodyLockInterface.h:65
virtual void UnlockWrite(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:73
virtual void UnlockRead(SharedMutex *inMutex) const override
Definition: BodyLockInterface.h:64
virtual void LockRead(MutexMask inMutexMask) const override
Definition: BodyLockInterface.h:70
Class that contains all bodies.
Definition: BodyManager.h:44
void LockWrite(MutexMask inMutexMask) const
Definition: BodyManager.cpp:714
void UnlockWrite(MutexMask inMutexMask) const
Definition: BodyManager.cpp:724
void UnlockRead(MutexMask inMutexMask) const
Definition: BodyManager.cpp:704
MutexMask GetMutexMask(const BodyID *inBodies, int inNumber) const
Definition: BodyManager.cpp:672
MutexMask GetAllBodiesMutexMask() const
Definition: BodyManager.h:183
SharedMutex & GetMutexForBody(const BodyID &inID) const
Access the mutex for a single body.
Definition: BodyManager.h:176
void LockRead(MutexMask inMutexMask) const
Definition: BodyManager.cpp:694
const Body * TryGetBody(const BodyID &inID) const
Access a body, will return a nullptr if the body ID is no longer valid (not protected by lock)
Definition: BodyManager.h:148
uint64 MutexMask
Bodies are protected using an array of mutexes (so a fixed number, not 1 per body)....
Definition: BodyManager.h:179
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition: NonCopyable.h:11
static void sLockShared(LockType &inMutex JPH_IF_ENABLE_ASSERTS(, PhysicsLockContext inContext, EPhysicsLockTypes inType))
Definition: PhysicsLock.h:68
static void sUnlock(LockType &inMutex JPH_IF_ENABLE_ASSERTS(, PhysicsLockContext inContext, EPhysicsLockTypes inType))
Definition: PhysicsLock.h:61
static void sUnlockShared(LockType &inMutex JPH_IF_ENABLE_ASSERTS(, PhysicsLockContext inContext, EPhysicsLockTypes inType))
Definition: PhysicsLock.h:75
static void sLock(LockType &inMutex JPH_IF_ENABLE_ASSERTS(, PhysicsLockContext inContext, EPhysicsLockTypes inType))
Definition: PhysicsLock.h:54