15template <
class MutexType>
35 mMutexStorage =
new MutexStorage[inNumMutexes];
36 mNumMutexes = inNumMutexes;
49 return hasher(inObjectIndex) & (mNumMutexes - 1);
61 return mMutexStorage[inMutexIndex].mMutex;
69 MutexStorage *end = mMutexStorage + mNumMutexes;
70 for (MutexStorage *m = mMutexStorage; m < end; ++m)
79 MutexStorage *end = mMutexStorage + mNumMutexes;
80 for (MutexStorage *m = mMutexStorage; m < end; ++m)
86 struct alignas(JPH_CACHE_LINE_SIZE) MutexStorage
93 MutexStorage * mMutexStorage =
nullptr;
unsigned int uint
Definition Core.h:453
#define JPH_NAMESPACE_END
Definition Core.h:379
std::uint32_t uint32
Definition Core.h:456
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
constexpr bool IsPowerOf2(T inV)
Check if inV is a power of 2.
Definition Math.h:73
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
#define JPH_PROFILE_FUNCTION()
Scope profiling for function.
Definition Profiler.h:271
Definition MutexArray.h:17
MutexArray(uint inNumMutexes)
Constructor, constructs an array with inNumMutexes entries.
Definition MutexArray.h:23
uint32 GetMutexIndex(uint32 inObjectIndex) const
Convert an object index to a mutex index.
Definition MutexArray.h:46
~MutexArray()
Destructor.
Definition MutexArray.h:26
MutexType & GetMutexByObjectIndex(uint32 inObjectIndex)
Get the mutex belonging to a certain object by index.
Definition MutexArray.h:53
void UnlockAll()
Unlock all mutexes.
Definition MutexArray.h:75
void LockAll()
Lock all mutexes.
Definition MutexArray.h:65
MutexArray()=default
Constructor, constructs an empty mutex array that you need to initialize with Init()
void Init(uint inNumMutexes)
Definition MutexArray.h:30
MutexType & GetMutexByIndex(uint32 inMutexIndex)
Get a mutex by index in the array.
Definition MutexArray.h:59
uint GetNumMutexes() const
Get the number of mutexes that were allocated.
Definition MutexArray.h:40
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition NonCopyable.h:11
Fallback hash function that calls T::GetHash()
Definition HashCombine.h:59