Dali 3D User Interface Engine
Namespaces | Functions
Dali::Internal::Mutex Namespace Reference

Namespace to ensure mutex locking is done correctly. More...

Namespaces

namespace  anonymous_namespace{mutex-impl.cpp}
 

Functions

void Lock (pthread_mutex_t *mutex)
 Locks the given mutex. More...
 
void Unlock (pthread_mutex_t *mutex)
 Unlocks the given mutex. More...
 

Detailed Description

Namespace to ensure mutex locking is done correctly.

Displays warnings if two mutex locks are not held by the same thread at any given time which can lead to deadlock. This can lead to deadlock and should be avoided.

Note
lock backtrace needs to be enabled to see the warnings.

Function Documentation

void Dali::Internal::Mutex::Lock ( pthread_mutex_t *  mutex)

Locks the given mutex.

Increments a thread-local storage counter.

Parameters
Apointer to the mutex that should be locked.
Note
If the counter is > 1 and lock backtrace is enabled, then the backtrace for all locks will be shown as a warning.

Definition at line 69 of file mutex-impl.cpp.

References DALI_LOG_ERROR, DALI_LOG_WARNING, Dali::Demangle(), and Dali::Internal::Mutex::anonymous_namespace{mutex-impl.cpp}::gThreadLockCount.

Referenced by Dali::ConditionalWait::Notify(), Dali::ConditionalWait::ScopedLock::ScopedLock(), Dali::Mutex::ScopedLock::ScopedLock(), and Dali::ConditionalWait::Wait().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Mutex::Unlock ( pthread_mutex_t *  mutex)

Unlocks the given mutex.

Parameters
Apointer to the mutex that should be unlocked.

Decrements a thread-local storage counter.

Definition at line 116 of file mutex-impl.cpp.

References DALI_LOG_ERROR, and Dali::Internal::Mutex::anonymous_namespace{mutex-impl.cpp}::gThreadLockCount.

Referenced by Dali::ConditionalWait::Notify(), Dali::ConditionalWait::Wait(), Dali::ConditionalWait::ScopedLock::~ScopedLock(), and Dali::Mutex::ScopedLock::~ScopedLock().

Here is the caller graph for this function:

Dali Docs Home
Read more about Dali