Rudiments
|
Inherits object.
Public Member Functions | |
threadmutex () | |
threadmutex (void *mut) | |
~threadmutex () | |
bool | lock () |
bool | tryLock () |
bool | unlock () |
void * | getInternalMutexStructure () |
Public Member Functions inherited from object | |
virtual | ~object () |
The threadmutex class provides mutual exclusion locks between separate threads of a single process.
threadmutex::threadmutex | ( | ) |
Creates an instance of the threadmutex class.
threadmutex::threadmutex | ( | void * | mut | ) |
Creates an instance of the threadmutex class that uses an already-initialized, system-specific threadmutex structure. On unix systems, this would likely be an instance of struct pthread_mutex_t, though it could possibly be something else.
threadmutex::~threadmutex | ( | ) |
Deletes this instance of the threadmutex class.
void* threadmutex::getInternalMutexStructure | ( | ) |
Returns the mutex structure used by the class internally. On unix systems this would most likely be a struct pthread_mutex_t *, though it could possibly be something else.
bool threadmutex::lock | ( | ) |
Locks the mutex. Will wait until the lock succeds. Returns true on success and false if an error occurs.
bool threadmutex::tryLock | ( | ) |
Attempts to lock the mutex. Will return immediately if the mutex could not be locked, returning false and setting errno to EBUSY. Returns true on success and false if an error occurs.
bool threadmutex::unlock | ( | ) |
Unlocks the mutex. Returns true on success and false if an error occurs.