MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _thread_get_mutex_priority

Function _thread_get_mutex_priority

src/ipc.c:846–866  ·  view source on GitHub ↗

get highest priority inside its taken object and its init priority */

Source from the content-addressed store, hash-verified

844
845/* get highest priority inside its taken object and its init priority */
846rt_inline rt_uint8_t _thread_get_mutex_priority(struct rt_thread* thread)
847{
848 rt_list_t *node = RT_NULL;
849 struct rt_mutex *mutex = RT_NULL;
850 rt_uint8_t priority = rt_sched_thread_get_init_prio(thread);
851
852 rt_list_for_each(node, &(thread->taken_object_list))
853 {
854 mutex = rt_list_entry(node, struct rt_mutex, taken_list);
855 rt_uint8_t mutex_prio = mutex->priority;
856 /* prio at least be priority ceiling */
857 mutex_prio = mutex_prio < mutex->ceiling_priority ? mutex_prio : mutex->ceiling_priority;
858
859 if (priority > mutex_prio)
860 {
861 priority = mutex_prio;
862 }
863 }
864
865 return priority;
866}
867
868/* update priority of target thread and the thread suspended it if any */
869rt_inline void _thread_update_priority(struct rt_thread *thread, rt_uint8_t priority, int suspend_flag)

Callers 5

_thread_update_priorityFunction · 0.85
_check_and_update_prioFunction · 0.85
rt_mutex_drop_threadFunction · 0.85
rt_mutex_setprioceilingFunction · 0.85
_rt_mutex_takeFunction · 0.85

Calls 1

Tested by

no test coverage detected