-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
1.初始化mutex的flag=RT_IPC_FLAG_FIFO.
2.多个不同优先级线程take这个mutex
3.拥有mutex的线程rt_mutex_release
if (!rt_list_isempty(&mutex->parent.suspend_thread))
{
/* get suspended thread */
thread = rt_list_entry(mutex->parent.suspend_thread.next,
struct rt_thread,
tlist);
RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n",
thread->name));
/* set new owner and priority */
mutex->owner = thread;
mutex->original_priority = thread->current_priority;
mutex->hold ++;
/* resume thread */
rt_ipc_list_resume(&(mutex->parent.suspend_thread));
need_schedule = RT_TRUE;
}
这时当前代码会让队列中的第一个thread拥有mutex,符合FIFO,但可能队列中会有更高优先级的thread,当前代码是否需要考虑释放mutex时,使用队列中最高优先级来修改当前thread的优先级?
或者RTTHREAD认为这种情况该使用mutex的flag=RT_IPC_FLAG_PRIO?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels