Gecode::Support::FastMutex Class Reference
[Simple thread and synchronization support]
A fast mutex for mutual exclausion among several threads. More...
#include <thread.hpp>
Public Member Functions | |
FastMutex (void) | |
Initialize mutex. | |
void | acquire (void) |
Acquire the mutex and possibly block. | |
bool | tryacquire (void) |
Try to acquire the mutex, return true if succesful. | |
void | release (void) |
Release the mutex. | |
~FastMutex (void) | |
Delete mutex. | |
Static Public Member Functions | |
static void * | operator new (size_t s) |
Allocate memory from heap. | |
static void | operator delete (void *p) |
Free memory allocated from heap. |
Detailed Description
A fast mutex for mutual exclausion among several threads.
This mutex is implemeneted using spin locks on some platforms and is not guaranteed to be compatible with events. It should be used for low-contention locks that are only acquired for short periods of time.
It is not specified whether the mutex is recursive or not. Likewise, there is no guarantee of fairness among the blocking threads.
Definition at line 155 of file thread.hpp.
Constructor & Destructor Documentation
Gecode::Support::FastMutex::FastMutex | ( | void | ) | [inline] |
Initialize mutex.
Definition at line 102 of file pthreads.hpp.
Gecode::Support::FastMutex::~FastMutex | ( | void | ) | [inline] |
Delete mutex.
Definition at line 121 of file pthreads.hpp.
Member Function Documentation
void Gecode::Support::FastMutex::acquire | ( | void | ) | [inline] |
Acquire the mutex and possibly block.
Definition at line 107 of file pthreads.hpp.
bool Gecode::Support::FastMutex::tryacquire | ( | void | ) | [inline] |
Try to acquire the mutex, return true if succesful.
Definition at line 112 of file pthreads.hpp.
void Gecode::Support::FastMutex::release | ( | void | ) | [inline] |
Release the mutex.
Definition at line 116 of file pthreads.hpp.
void * Gecode::Support::FastMutex::operator new | ( | size_t | s | ) | [inline, static] |
Allocate memory from heap.
Definition at line 74 of file thread.hpp.
void Gecode::Support::FastMutex::operator delete | ( | void * | p | ) | [inline, static] |
Free memory allocated from heap.
Definition at line 79 of file thread.hpp.
The documentation for this class was generated from the following files:
- gecode/support/thread.hpp (Revision: 14025)
- gecode/support/thread/pthreads.hpp (Revision: 13741)
- gecode/support/thread/thread.hpp (Revision: 13740)