MPMA Framework 0.4
|
Thread locking constructs and atomic functions. More...
Go to the source code of this file.
Classes | |
class | MPMA::MutexLock |
A (re-entrant safe) lock based on the operating system's mutexes. More... | |
class | MPMA::TakeMutexLock |
Used to lock/unlock a MutexLock automatically using scope. The lock is released on dustruction. More... | |
class | MPMA::SpinLock |
A light-weight spin-lock (NOT re-entrant safe from the same thread) that reverts to a sleeplock on single cpu systems. This is a reference counted object, so all copies of the object still refer to the same lock. More... | |
class | MPMA::TakeSpinLock |
Used to lock/unlock a spinlock automatically using scope. The lock is released on destruction. More... | |
class | MPMA::RWSleepLock |
ReaderWriter sleep-lock (re-entrant safe). Read locks don't block each other, but Write locks are exclusive to all other locks. This is a reference counted object, so all copies of the object still refer to the same lock. More... | |
class | MPMA::TakeRWSleepLock |
Used to lock/unlock a RWSleepLock automatically using scope. The lock is released on dustruction. More... | |
class | MPMA::BlockingObject |
An object that can be used to block a thread until another thread signals it to resume. This is a reference counted object, so all copies of the object still refer to the same lock. More... | |
Namespaces | |
namespace | MPMA |
The Base MPMA Framework. | |
Functions | |
void | MPMA::AtomicIntInc (volatile nuint *pint) |
Atomically increments an integer. | |
void | MPMA::AtomicIntDec (volatile nuint *pint) |
Atomically decrements an integer. | |
nsint | MPMA::AtomicIntAdd (volatile nsint *pint, nsint addValue) |
Atomically adds one integer to another and returns the value of the original. | |
bool | MPMA::AtomicCompareExchange (volatile nuint *pInt, nuint expectedValue, nuint newValue, volatile nuint &outResultValue) |
Compares expectedValue with the value at pInt, and if they are the same, sets pInt to newValue and returns true with outResultValue set to newValue. If they are different then pInt is unaffected, and returns false with outResultValue set to the value that was found at pInt. | |
template<typename T > | |
bool | MPMA::AtomicCompareExchange (T **ptrToReplace, T *ptrExpected, T *ptrToSet, T *&outResultValue) |
Compares ptrExpected with the value at ptrToReplace, and if they are the same, sets ptrToReplace to ptrToSet and returns true with outResultValue set to ptrToSet. If they are different then ptrToReplace is unaffected, and returns false with outResultValue set to the value that was found at ptrToReplace. |
Thread locking constructs and atomic functions.