Provides an OOP interface to the Eina_Lock
and automatic resource allocation and deallocation using the RAII programming idiom.
More...
Public Types | |
typedef Eina_Lock * | native_handle_type |
Type for the native Eina_Lock pointer. More... | |
Public Member Functions | |
mutex () | |
Create a new mutex. More... | |
~mutex () | |
Release mutex resources. More... | |
void | lock () |
Lock the mutex. More... | |
bool | try_lock () |
Attempts to lock the mutex. More... | |
void | unlock () |
Unlock the lock. More... | |
void | debug () |
Print debug information about the mutex. More... | |
native_handle_type | native_handle () |
Get a handle for the wrapped Eina_Lock . More... | |
Provides an OOP interface to the Eina_Lock
and automatic resource allocation and deallocation using the RAII programming idiom.
This class implements mutual exclusion variables (mutexes) in a way that strongly resembles the STL std::mutex
.
typedef Eina_Lock* efl::eina::mutex::native_handle_type |
Type for the native Eina_Lock pointer.
|
inline |
Create a new mutex.
Automatically allocates a new mutex and does any platform dependent initialization that is required.
References eina_lock_new().
|
inline |
Release mutex resources.
Automatically deallocates the mutex and does any platform dependent cleanup that is required.
References eina_lock_free().
|
inline |
Lock the mutex.
<tt>eina::system_error</tt> | with the code eina::errc::resource_deadlock_would_occur if the operation fails because a deadlock condition exists. If some other condition causes the lock to fail (other than the mutex being already locked) the error code will be an internal Eina error code. |
This member function locks the mutex. If the mutex is locked already, this call will block until the lock is released. This is appropriate in many cases, but consider using try_lock() if you don't need to block.
References EINA_LOCK_DEADLOCK, EINA_LOCK_SUCCEED, and eina_lock_take().
|
inline |
Attempts to lock the mutex.
true
if it succeed in locking the mutex, false
otherwise. <tt>eina::system_error</tt> | with the code eina::errc::resource_deadlock_would_occur if the operation fails because a deadlock condition exists. If some other condition causes the lock to fail (other than the mutex being already locked) the error code will be an internal Eina error code. |
This member function attempts to lock the mutex, identical to lock(), but returns immediately if the mutex is already locked.
References EINA_LOCK_DEADLOCK, EINA_LOCK_FAIL, EINA_LOCK_SUCCEED, and eina_lock_take_try().
|
inline |
Unlock the lock.
<tt>eina::system_error</tt> | with the code eina::errc::resource_deadlock_would_occur if the operation fails because a deadlock condition exists. If some other condition causes the lock to fail the error code will be an internal Eina error code. |
This member function will unlock the mutex.
References EINA_LOCK_DEADLOCK, eina_lock_release(), and EINA_LOCK_SUCCEED.
|
inline |
Print debug information about the mutex.
This member function prints debug information for the mutex. The information is platform dependent. On POSIX systems it will print the address of mutex, lock state, thread number and a backtrace.
References eina_lock_debug().
|
inline |
Get a handle for the wrapped Eina_Lock
.
Eina_Lock
.This member function returns the native Eina_Lock
handle that is wrapped inside this object.
Referenced by efl::eina::condition_variable::condition_variable().