Jolt Physics
A multi core friendly Game Physics Engine
|
#include <MutexArray.h>
Public Member Functions | |
MutexArray ()=default | |
Constructor, constructs an empty mutex array that you need to initialize with Init() More... | |
MutexArray (uint inNumMutexes) | |
Constructor, constructs an array with inNumMutexes entries. More... | |
~MutexArray () | |
Destructor. More... | |
void | Init (uint inNumMutexes) |
uint | GetNumMutexes () const |
Get the number of mutexes that were allocated. More... | |
uint32 | GetMutexIndex (uint32 inObjectIndex) const |
Convert an object index to a mutex index. More... | |
MutexType & | GetMutexByObjectIndex (uint32 inObjectIndex) |
Get the mutex belonging to a certain object by index. More... | |
MutexType & | GetMutexByIndex (uint32 inMutexIndex) |
Get a mutex by index in the array. More... | |
void | LockAll () |
Lock all mutexes. More... | |
void | UnlockAll () |
Unlock all mutexes. More... | |
Public Member Functions inherited from NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
void | operator= (const NonCopyable &)=delete |
A mutex array protects a number of resources with a limited amount of mutexes. It uses hashing to find the mutex of a particular object. The idea is that if the amount of threads is much smaller than the amount of mutexes that there is a relatively small chance that two different objects map to the same mutex.
|
default |
Constructor, constructs an empty mutex array that you need to initialize with Init()
|
inlineexplicit |
Constructor, constructs an array with inNumMutexes entries.
|
inline |
Destructor.
|
inline |
Get a mutex by index in the array.
|
inline |
Get the mutex belonging to a certain object by index.
|
inline |
Convert an object index to a mutex index.
|
inline |
Get the number of mutexes that were allocated.
|
inline |
Initialization
inNumMutexes | The amount of mutexes to allocate |
|
inline |
Lock all mutexes.
|
inline |
Unlock all mutexes.