|
39 | 39 | * 2020-10-11 Meco Man add value overflow-check code |
40 | 40 | * 2021-01-03 Meco Man implement rt_mb_urgent() |
41 | 41 | * 2021-05-30 Meco Man implement rt_mutex_trytake() |
42 | | - * 2021-01-20 hupu fix priority inversion bug of mutex |
43 | 42 | */ |
44 | 43 |
|
45 | 44 | #include <rtthread.h> |
@@ -194,31 +193,6 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list) |
194 | 193 | return RT_EOK; |
195 | 194 | } |
196 | 195 |
|
197 | | -/** |
198 | | - * This function will get the highest priority from the specified |
199 | | - * list of threads |
200 | | - * |
201 | | - * @param list of the threads |
202 | | - * |
203 | | - * @return the highest priority |
204 | | - */ |
205 | | -rt_uint8_t rt_ipc_get_highest_priority(rt_list_t *list) |
206 | | -{ |
207 | | - struct rt_list_node *n; |
208 | | - struct rt_thread *sthread; |
209 | | - rt_uint8_t priority = RT_THREAD_PRIORITY_MAX - 1; |
210 | | - |
211 | | - for (n = list->next; n != list; n = n->next) |
212 | | - { |
213 | | - sthread = rt_list_entry(n, struct rt_thread, tlist); |
214 | | - |
215 | | - priority = priority < sthread->current_priority ? |
216 | | - priority : |
217 | | - sthread->current_priority; |
218 | | - } |
219 | | - return priority; |
220 | | -} |
221 | | - |
222 | 196 | #ifdef RT_USING_SEMAPHORE |
223 | 197 | /** |
224 | 198 | * This function will initialize a semaphore and put it under control of |
@@ -870,7 +844,6 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) |
870 | 844 | register rt_base_t temp; |
871 | 845 | struct rt_thread *thread; |
872 | 846 | rt_bool_t need_schedule; |
873 | | - rt_uint8_t max_priority_in_queue = RT_THREAD_PRIORITY_MAX - 1; |
874 | 847 |
|
875 | 848 | /* parameter check */ |
876 | 849 | RT_ASSERT(mutex != RT_NULL); |
@@ -932,21 +905,6 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) |
932 | 905 | mutex->owner = thread; |
933 | 906 | mutex->original_priority = thread->current_priority; |
934 | 907 |
|
935 | | - /* Priority adjustment occurs only when the following conditions |
936 | | - * are met simultaneously: |
937 | | - * 1.The type of mutex is RT_IPC_FLAG_FIFO; |
938 | | - * 2.The priority of the thread to be resumed is not equal to the |
939 | | - * highest priority in the queue; |
940 | | - */ |
941 | | - max_priority_in_queue = rt_ipc_get_highest_priority(&mutex->parent.suspend_thread); |
942 | | - if (mutex->parent.parent.flag == RT_IPC_FLAG_FIFO && |
943 | | - thread->current_priority != max_priority_in_queue) |
944 | | - { |
945 | | - rt_thread_control(thread, |
946 | | - RT_THREAD_CTRL_CHANGE_PRIORITY, |
947 | | - &(max_priority_in_queue)); |
948 | | - } |
949 | | - |
950 | 908 | if(mutex->hold < RT_MUTEX_HOLD_MAX) |
951 | 909 | { |
952 | 910 | mutex->hold ++; |
|
0 commit comments