19 #ifndef _MINLIB_AUTOLOCK_H_
20 #define _MINLIB_AUTOLOCK_H_
29 #if (MN_THREAD_CONFIG_RECURSIVE_MUTEX == MN_THREAD_CONFIG_YES)
34 #define portMAX_DELAY 0xffffffffUL
53 #if (MN_THREAD_CONFIG_RECURSIVE_MUTEX == MN_THREAD_CONFIG_YES)
57 #if MN_THREAD_CONFIG_LOCK_TYPE == MN_THREAD_CONFIG_MUTEX
59 #elif MN_THREAD_CONFIG_LOCK_TYPE == MN_THREAD_CONFIG_BINARY_SEMAPHORE
61 #elif MN_THREAD_CONFIG_LOCK_TYPE == MN_THREAD_CONFIG_COUNTING_SEMAPHORE
69 template <
class TLOCK = LockType_t>
70 int lock(TLOCK& m1,
unsigned int timeout) {
return m1.lock(timeout); }
72 template <
class TLOCK = LockType_t>
73 int unlock(TLOCK& m1) {
return m1.unlock(); }
75 template <
class TLOCK = LockType_t>
76 bool try_lock(TLOCK& m1) {
return m1.try_lock(); }
Definition: mn_lock.hpp:122
Definition: mn_binary_semaphore.hpp:29
Definition: mn_allocator_typetraits.hpp:25
basic_mutex mutex_t
Definition: mn_mutex.hpp:76
basic_counting_semaphore counting_semaphore_t
Definition: mn_counting_semaphore.hpp:82
int lock(TLOCK &m1, unsigned int timeout)
Definition: mn_autolock.hpp:70
int unlock(TLOCK &m1)
Definition: mn_autolock.hpp:73
bool try_lock(TLOCK &m1)
Definition: mn_autolock.hpp:76
basic_binary_semaphore binary_semaphore_t
Definition: mn_binary_semaphore.hpp:47