RT-Thread RTOS
1.2.0
An open source embedded real-time operating system
|
Data Structures | |
struct | rt_mutex |
Functions | |
rt_err_t | rt_mutex_init (rt_mutex_t mutex, const char *name, rt_uint8_t flag) |
rt_err_t | rt_mutex_detach (rt_mutex_t mutex) |
void | rt_mutex_drop_thread (rt_mutex_t mutex, rt_thread_t thread) |
rt_uint8_t | rt_mutex_setprioceiling (rt_mutex_t mutex, rt_uint8_t priority) |
rt_uint8_t | rt_mutex_getprioceiling (rt_mutex_t mutex) |
rt_mutex_t | rt_mutex_create (const char *name, rt_uint8_t flag) |
rt_err_t | rt_mutex_delete (rt_mutex_t mutex) |
rt_err_t | rt_mutex_trytake (rt_mutex_t mutex) |
rt_err_t | rt_mutex_release (rt_mutex_t mutex) |
rt_err_t | rt_mutex_control (rt_mutex_t mutex, int cmd, void *arg) |
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. |
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. |
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
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. |
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_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. |
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_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_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_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. |