12template <
bool Write,
class BodyType>
21 mBodyLockInterface(inBodyLockInterface),
22 mMutexMask(inBodyLockInterface.GetMutexMask(inBodyIDs, inNumber)),
30 inBodyLockInterface.
LockWrite(mMutexMask);
32 inBodyLockInterface.
LockRead(mMutexMask);
49 inline BodyType *
GetBody(
int inBodyIndex)
const
52 JPH_ASSERT(inBodyIndex >= 0 && inBodyIndex < mNumBodyIDs);
55 const BodyID &body_id = mBodyIDs[inBodyIndex];
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
bool IsInvalid() const
Check if the ID is valid.
Definition BodyID.h:64
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
Body * TryGetBody(const BodyID &inBodyID) const
Convert body ID to body.
Definition BodyLockInterface.h:50
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 SharedMutex * LockWrite(const BodyID &inBodyID) const =0
Base class for locking multiple bodies for the duration of the scope of this class (do not use direct...
Definition BodyLockMulti.h:14
BodyType * GetBody(int inBodyIndex) const
Access the body (returns null if body was not properly locked)
Definition BodyLockMulti.h:49
~BodyLockMultiBase()
Destructor will unlock the bodies.
Definition BodyLockMulti.h:37
BodyLockMultiBase(const BodyLockInterface &inBodyLockInterface, const BodyID *inBodyIDs, int inNumber)
Constructor will lock the bodies.
Definition BodyLockMulti.h:20
BodyLockInterface::MutexMask MutexMask
Redefine MutexMask.
Definition BodyLockMulti.h:17
Definition BodyLockMulti.h:94
Specialization that locks multiple bodies for writing to.
Definition BodyLockMulti.h:100
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition NonCopyable.h:11