#include <LOW_thread_mutex.h>
Inheritance diagram for LOW_thread_mutex:
Public Types | |
enum | mutexKind_t { mutexKind_fast = 0, mutexKind_recursive, mutexKind_errorCheck } |
Basic type of a mutex. More... | |
Public Member Functions | |
class_DERIVE_FROM_EXCEPTION (thread_mutex_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_thread_mutex. | |
class_DERIVE_FROM_EXCEPTION (thread_mutex_locked, thread_mutex_error) | |
Exception class to indicate a mutex already locked by the calling thread. | |
class_DERIVE_FROM_EXCEPTION (thread_mutex_busy, thread_mutex_error) | |
Exception class to indicate a mutex locked by another thread. | |
LOW_thread_mutex (const mutexKind_t inMutexKind) | |
Constructor. | |
virtual | ~LOW_thread_mutex () |
Destructor. | |
virtual mutexKind_t | getKind () const |
Get kind of the mutex. | |
virtual void | lock ()=0 |
Obtain a lock on the mutex (blocking). | |
virtual void | tryLock ()=0 |
Obtain a lock on the mutex (non-blocking). | |
virtual void | unlock ()=0 |
Release a lock on the mutex. | |
Private Attributes | |
const mutexKind_t | mutexKind |
Each instance represents one thread mutex.
Specific platforms dereive their implementation classes from this class.
The instances are created by LOW_thread_Factory, following the factory design pattern.
Implementation classes must at least support three kinds od a mutex as defined by mutexKind_t.
This class is thread-safe.
Parts of the documentation taken from Linux man pages by Xavier Leroy.
Definition at line 43 of file LOW_thread_mutex.h.
|
Basic type of a mutex.
Definition at line 104 of file LOW_thread_mutex.h. Referenced by getKind(). |
|
Constructor.
Definition at line 29 of file LOW_thread_mutex.cpp. |
|
Destructor.
Definition at line 35 of file LOW_thread_mutex.cpp. |
|
Exception class to indicate a mutex locked by another thread.
|
|
Exception class to indicate a mutex already locked by the calling thread.
|
|
Exception base class for all exceptions thrown by LOW_thread_mutex.
|
|
Get kind of the mutex.
Definition at line 47 of file LOW_thread_mutex.cpp. References mutexKind, and mutexKind_t. |
|
Obtain a lock on the mutex (blocking). Blocks the calling thread if another thread has already locked the mutex. If the mutex is already locked by the calling thread, behaviour depends on the mutex kind:
Abstract method to be implemented by derived class.
Implemented in LOW_thread_mutex_POSIX. Referenced by LOW_link::commLock::commLock(), LOW_compJalousieController::jcLock::jcLock(), LOW_helper_msglog::msgLock::msgLock(), and LOW_thread_mutex::mutexLock::mutexLock(). |
|
Obtain a lock on the mutex (non-blocking). Behaves identically to lock(), except that it does not block the calling thread if the mutex is already locked by another thread. Instead an thread_mutex_busy exception is thrown. Abstract method to be implemented by derived class.
Implemented in LOW_thread_mutex_POSIX. |
|
Release a lock on the mutex. Behaviour depends on the mutex kind:
Abstract method to be implemented by derived class.
Implemented in LOW_thread_mutex_POSIX. Referenced by LOW_link::commLock::~commLock(), LOW_compJalousieController::jcLock::~jcLock(), LOW_helper_msglog::msgLock::~msgLock(), and LOW_thread_mutex::mutexLock::~mutexLock(). |
|
Definition at line 208 of file LOW_thread_mutex.h. Referenced by getKind(). |