Skip to content

Commit 02331fd

Browse files
committed
revert #3647
1 parent 3baad47 commit 02331fd

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

src/ipc.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
* event without pending
3939
* 2020-10-11 Meco Man add value overflow-check code
4040
* 2021-01-03 Meco Man add rt_mb_urgent()
41-
* 2021-01-20 hupu fix priority inversion bug of mutex
4241
*/
4342

4443
#include <rtthread.h>
@@ -192,31 +191,6 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list)
192191
return RT_EOK;
193192
}
194193

195-
/**
196-
* This function will get the highest priority from the specified
197-
* list of threads
198-
*
199-
* @param list of the threads
200-
*
201-
* @return the highest priority
202-
*/
203-
rt_uint8_t rt_ipc_get_highest_priority(rt_list_t *list)
204-
{
205-
struct rt_list_node *n;
206-
struct rt_thread *sthread;
207-
rt_uint8_t priority = RT_THREAD_PRIORITY_MAX - 1;
208-
209-
for (n = list->next; n != list; n = n->next)
210-
{
211-
sthread = rt_list_entry(n, struct rt_thread, tlist);
212-
213-
priority = priority < sthread->current_priority ?
214-
priority :
215-
sthread->current_priority;
216-
}
217-
return priority;
218-
}
219-
220194
#ifdef RT_USING_SEMAPHORE
221195
/**
222196
* This function will initialize a semaphore and put it under control of
@@ -855,7 +829,6 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
855829
register rt_base_t temp;
856830
struct rt_thread *thread;
857831
rt_bool_t need_schedule;
858-
rt_uint8_t max_priority_in_queue = RT_THREAD_PRIORITY_MAX - 1;
859832

860833
/* parameter check */
861834
RT_ASSERT(mutex != RT_NULL);
@@ -917,21 +890,6 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
917890
mutex->owner = thread;
918891
mutex->original_priority = thread->current_priority;
919892

920-
/* Priority adjustment occurs only when the following conditions
921-
* are met simultaneously:
922-
* 1.The type of mutex is RT_IPC_FLAG_FIFO;
923-
* 2.The priority of the thread to be resumed is not equal to the
924-
* highest priority in the queue;
925-
*/
926-
max_priority_in_queue = rt_ipc_get_highest_priority(&mutex->parent.suspend_thread);
927-
if (mutex->parent.parent.flag == RT_IPC_FLAG_FIFO &&
928-
thread->current_priority != max_priority_in_queue)
929-
{
930-
rt_thread_control(thread,
931-
RT_THREAD_CTRL_CHANGE_PRIORITY,
932-
&(max_priority_in_queue));
933-
}
934-
935893
if(mutex->hold < RT_MUTEX_HOLD_MAX)
936894
{
937895
mutex->hold ++;

0 commit comments

Comments
 (0)