RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
|
结构体 | |
struct | rt_mutex |
类型定义 | |
typedef struct rt_mutex * | rt_mutex_t |
typedef struct rt_mutex* rt_mutex_t |
rt_err_t rt_mutex_init | ( | rt_mutex_t | mutex, |
const char * | name, | ||
rt_uint8_t | flag ) |
Initialize a static mutex object.
mutex | is a pointer to the mutex to initialize. It is assumed that storage for the mutex will be allocated in your application. |
name | is a pointer to the name that given to the mutex. |
flag | is the mutex flag, which determines the queuing way of how multiple threads wait when the mutex is not available. NOTE: This parameter has been obsoleted. It can be RT_IPC_FLAG_PRIO, RT_IPC_FLAG_FIFO or RT_NULL. |
引用了 _ipc_object_init(), rt_mutex::ceiling_priority, rt_object::flag, rt_mutex::hold, rt_mutex::owner, rt_ipc_object::parent, rt_mutex::parent, rt_mutex::priority, RT_ASSERT, RT_IPC_FLAG_PRIO, rt_list_init(), RT_NULL, RT_Object_Class_Mutex, rt_object_init(), rt_spin_lock_init(), RT_UNUSED, rt_mutex::spinlock , 以及 rt_mutex::taken_list.
RTM_EXPORT | ( | rt_mutex_init | ) |
rt_err_t rt_mutex_detach | ( | rt_mutex_t | mutex | ) |
This function will detach a static mutex object.
mutex | is a pointer to a mutex object to be detached. |
引用了 rt_ipc_object::parent, rt_mutex::parent, RT_ASSERT, RT_NULL, RT_Object_Class_Mutex, rt_object_detach(), rt_object_get_type() , 以及 rt_object_is_systemobject().
RTM_EXPORT | ( | rt_mutex_detach | ) |
void rt_mutex_drop_thread | ( | rt_mutex_t | mutex, |
rt_thread_t | thread ) |
drop a thread from the suspend list of mutex
mutex | is a pointer to a mutex object. |
thread | is the thread should be dropped from mutex. |
Should change the priority of mutex owner thread Note: After current thread is detached from mutex pending list, there is a chance that the mutex owner has been released the mutex. Which means mutex->owner can be NULL at this point. If that happened, it had already reset its priority. So it's okay to skip
引用了 _thread_get_mutex_priority(), _thread_update_priority(), rt_list_node::next, rt_mutex::owner, rt_ipc_object::parent, rt_mutex::parent, rt_thread::pending_object, rt_mutex::priority, RT_ASSERT, RT_DEBUG_IN_THREAD_CONTEXT, RT_FALSE, rt_list_isempty(), rt_list_remove(), RT_NULL, rt_sched_lock(), rt_sched_thread_get_curr_prio(), rt_sched_unlock(), rt_spin_lock(), rt_spin_unlock(), RT_THREAD_LIST_NODE, RT_THREAD_LIST_NODE_ENTRY, RT_TRUE, RT_UNINTERRUPTIBLE, rt_mutex::spinlock , 以及 rt_ipc_object::suspend_thread.
rt_uint8_t rt_mutex_setprioceiling | ( | rt_mutex_t | mutex, |
rt_uint8_t | priority ) |
set the prioceiling attribute of the mutex.
mutex | is a pointer to a mutex object. |
priority | is the priority should be set to mutex. |
引用了 _thread_get_mutex_priority(), _thread_update_priority(), rt_mutex::ceiling_priority, rt_mutex::owner, RT_DEBUG_IN_THREAD_CONTEXT, rt_sched_lock(), rt_sched_thread_get_curr_prio(), rt_sched_unlock(), rt_spin_lock(), rt_spin_unlock(), RT_UNINTERRUPTIBLE , 以及 rt_mutex::spinlock.
RTM_EXPORT | ( | rt_mutex_setprioceiling | ) |
rt_uint8_t rt_mutex_getprioceiling | ( | rt_mutex_t | mutex | ) |
set the prioceiling attribute of the mutex.
mutex | is a pointer to a mutex object. |
引用了 rt_mutex::ceiling_priority, RT_ASSERT, RT_DEBUG_IN_THREAD_CONTEXT, RT_NULL, rt_spin_lock(), rt_spin_unlock() , 以及 rt_mutex::spinlock.
RTM_EXPORT | ( | rt_mutex_getprioceiling | ) |
rt_mutex_t rt_mutex_create | ( | const char * | name, |
rt_uint8_t | flag ) |
This function will create a mutex object.
name | is a pointer to the name that given to the mutex. |
flag | is the mutex flag, which determines the queuing way of how multiple threads wait when the mutex is not available. NOTE: This parameter has been obsoleted. It can be RT_IPC_FLAG_PRIO, RT_IPC_FLAG_FIFO or RT_NULL. |
引用了 _ipc_object_init(), rt_mutex::ceiling_priority, rt_object::flag, rt_mutex::hold, rt_mutex::owner, rt_ipc_object::parent, rt_mutex::parent, rt_mutex::priority, RT_DEBUG_NOT_IN_INTERRUPT, RT_IPC_FLAG_PRIO, rt_list_init(), RT_NULL, rt_object_allocate(), RT_Object_Class_Mutex, rt_spin_lock_init(), RT_UNUSED, rt_mutex::spinlock , 以及 rt_mutex::taken_list.
RTM_EXPORT | ( | rt_mutex_create | ) |
rt_err_t rt_mutex_delete | ( | rt_mutex_t | mutex | ) |
This function will delete a mutex object and release this memory space.
mutex | is a pointer to a mutex object to be deleted. |
引用了 rt_ipc_object::parent, rt_mutex::parent, RT_ASSERT, RT_DEBUG_NOT_IN_INTERRUPT, RT_FALSE, RT_NULL, RT_Object_Class_Mutex, rt_object_delete(), rt_object_get_type() , 以及 rt_object_is_systemobject().
RTM_EXPORT | ( | rt_mutex_delete | ) |
rt_err_t rt_mutex_take | ( | rt_mutex_t | mutex, |
rt_int32_t | time ) |
RTM_EXPORT | ( | rt_mutex_take | ) |
rt_err_t rt_mutex_take_interruptible | ( | rt_mutex_t | mutex, |
rt_int32_t | time ) |
RTM_EXPORT | ( | rt_mutex_take_interruptible | ) |
rt_err_t rt_mutex_take_killable | ( | rt_mutex_t | mutex, |
rt_int32_t | time ) |
RTM_EXPORT | ( | rt_mutex_take_killable | ) |
rt_err_t rt_mutex_trytake | ( | rt_mutex_t | mutex | ) |
This function will try to take a mutex, if the mutex is unavailable, the thread returns immediately.
mutex | is a pointer to a mutex object. |
引用了 rt_mutex_take() , 以及 RT_WAITING_NO.
RTM_EXPORT | ( | rt_mutex_trytake | ) |
rt_err_t rt_mutex_release | ( | rt_mutex_t | mutex | ) |
This function will release a mutex. If there is thread suspended on the mutex, the thread will be resumed.
mutex | is a pointer to a mutex object. |
a timeout timer had triggered while we try. So we skip this thread and try again.
引用了 rt_thread::error, rt_mutex::hold, LOG_D, rt_object::name, rt_list_node::next, rt_mutex::owner, rt_ipc_object::parent, rt_mutex::parent, rt_thread::parent, rt_thread::pending_object, rt_mutex::priority, RT_ASSERT, RT_DEBUG_IN_THREAD_CONTEXT, RT_FALSE, rt_list_insert_after(), rt_list_isempty(), rt_list_remove(), RT_NULL, RT_Object_Class_Mutex, rt_object_get_type(), RT_OBJECT_HOOK_CALL, rt_sched_lock(), rt_sched_thread_get_curr_prio(), rt_sched_thread_is_suspended(), rt_sched_thread_ready(), rt_sched_unlock(), rt_schedule(), rt_spin_lock(), rt_spin_unlock(), RT_THREAD_LIST_NODE, RT_THREAD_LIST_NODE_ENTRY, rt_thread_self(), RT_TRUE, rt_mutex::spinlock, rt_ipc_object::suspend_thread, rt_mutex::taken_list , 以及 rt_thread::taken_object_list.
RTM_EXPORT | ( | rt_mutex_release | ) |
rt_err_t rt_mutex_control | ( | rt_mutex_t | mutex, |
int | cmd, | ||
void * | arg ) |
This function will set some extra attributions of a mutex object.
mutex | is a pointer to a mutex object. |
cmd | is a command word used to configure some attributions of the mutex. |
arg | is the argument of the function to execute the command. |
引用了 RT_UNUSED.
RTM_EXPORT | ( | rt_mutex_control | ) |
rt_inline rt_thread_t rt_mutex_get_owner | ( | rt_mutex_t | mutex | ) |
rt_inline rt_ubase_t rt_mutex_get_hold | ( | rt_mutex_t | mutex | ) |