Implementation of m0_arch_mutex on top of Linux struct mutex.
Linux kernel mutex.
User space mutex.
Implementation of m0_arch_mutex on top of pthread_mutex_t.
◆ M0_ARCH_MUTEX_SINIT [1/2]
#define M0_ARCH_MUTEX_SINIT |
( |
|
arch_m | ) |
{ .m_mutex = __MUTEX_INITIALIZER((arch_m).m_mutex) } |
◆ M0_ARCH_MUTEX_SINIT [2/2]
#define M0_ARCH_MUTEX_SINIT |
( |
|
arch_m | ) |
{ .m_impl = PTHREAD_MUTEX_INITIALIZER } |
◆ M0_MUTEX_SINIT
Mutex static initialiser.
This macro is useful only for global static mutexes, in other cases m0_mutex_init() should be used.
Definition at line 63 of file mutex.h.
◆ M0_TRACE_SUBSYSTEM
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LIB |
◆ m0_arch_mutex_fini()
M0_INTERNAL void m0_arch_mutex_fini |
( |
struct m0_arch_mutex * |
mutex | ) |
|
◆ m0_arch_mutex_init()
M0_INTERNAL void m0_arch_mutex_init |
( |
struct m0_arch_mutex * |
mutex | ) |
|
◆ m0_arch_mutex_lock()
M0_INTERNAL void m0_arch_mutex_lock |
( |
struct m0_arch_mutex * |
mutex | ) |
|
◆ m0_arch_mutex_trylock()
M0_INTERNAL int m0_arch_mutex_trylock |
( |
struct m0_arch_mutex * |
mutex | ) |
|
◆ m0_arch_mutex_unlock()
M0_INTERNAL void m0_arch_mutex_unlock |
( |
struct m0_arch_mutex * |
mutex | ) |
|
◆ m0_mutex_fini()
M0_INTERNAL void m0_mutex_fini |
( |
struct m0_mutex * |
mutex | ) |
|
◆ m0_mutex_init()
M0_INTERNAL void m0_mutex_init |
( |
struct m0_mutex * |
mutex | ) |
|
◆ m0_mutex_is_locked()
M0_INTERNAL bool m0_mutex_is_locked |
( |
const struct m0_mutex * |
mutex | ) |
|
True iff mutex is locked by the calling thread.
- Note
- this function can be used only in assertions.
Definition at line 95 of file mutex.c.
◆ m0_mutex_is_not_locked()
M0_INTERNAL bool m0_mutex_is_not_locked |
( |
const struct m0_mutex * |
mutex | ) |
|
True iff mutex is not locked by the calling thread.
- Note
- this function can be used only in assertions.
Definition at line 101 of file mutex.c.
◆ m0_mutex_lock()
M0_INTERNAL void m0_mutex_lock |
( |
struct m0_mutex * |
mutex | ) |
|
Returns with the mutex locked.
- Precondition
- m0_mutex_is_not_locked(mutex)
- Postcondition
- m0_mutex_is_locked(mutex)
Definition at line 49 of file mutex.c.
◆ m0_mutex_trylock()
M0_INTERNAL int m0_mutex_trylock |
( |
struct m0_mutex * |
mutex | ) |
|
Try to take a mutex lock. Returns 0 with the mutex locked, or non-zero if lock is already hold by others.
Definition at line 84 of file mutex.c.
◆ m0_mutex_unlock()
M0_INTERNAL void m0_mutex_unlock |
( |
struct m0_mutex * |
mutex | ) |
|
Unlocks the mutex.
- Precondition
- m0_mutex_is_locked(mutex)
- Postcondition
- m0_mutex_is_not_locked(mutex)
Definition at line 66 of file mutex.c.