28 #include <rtt/os/ecos_rec_mutex.h> 32 cyg_mutex_init(&(mx->
mutex));
42 if( cyg_thread_self() == mx->
owner )
49 result = cyg_mutex_lock( &mx->
mutex );
51 mx->
owner = cyg_thread_self();
54 cyg_scheduler_unlock();
63 if( cyg_thread_self() == mx->
owner ) {
67 result = cyg_mutex_trylock( &mx->
mutex );
70 mx->
owner = cyg_thread_self();
74 cyg_scheduler_unlock();
82 if( cyg_thread_self() == mx->
owner )
90 cyg_mutex_unlock( &mx->
mutex );
94 diag_printf(
"recursive mutex: not locked\n");
97 diag_printf(
"Error unlocking recursive mutex: you're not the owner!\n");
99 cyg_scheduler_unlock();
105 cyg_mutex_release(&(mx->
mutex));
106 cyg_mutex_destroy(&(mx->
mutex));
void cyg_recursive_mutex_init(cyg_recursive_mutex_t *mx)
Initialize recursive mutex.
void cyg_recursive_mutex_destroy(cyg_recursive_mutex_t *mx)
Destroy.
bool cyg_recursive_mutex_trylock(cyg_recursive_mutex_t *mx)
Trylock.
bool cyg_recursive_mutex_lock(cyg_recursive_mutex_t *mx)
Lock recursive mutex.
void cyg_recursive_mutex_unlock(cyg_recursive_mutex_t *mx)
Unlock.