|
38 | 38 | * event without pending |
39 | 39 | * 2020-10-11 Meco Man add value overflow-check code |
40 | 40 | * 2021-01-03 Meco Man add rt_mb_urgent() |
41 | | - * 2021-01-20 hupu fix priority inversion bug of mutex |
42 | 41 | */ |
43 | 42 |
|
44 | 43 | #include <rtthread.h> |
@@ -192,31 +191,6 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list) |
192 | 191 | return RT_EOK; |
193 | 192 | } |
194 | 193 |
|
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 | | - |
220 | 194 | #ifdef RT_USING_SEMAPHORE |
221 | 195 | /** |
222 | 196 | * 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) |
855 | 829 | register rt_base_t temp; |
856 | 830 | struct rt_thread *thread; |
857 | 831 | rt_bool_t need_schedule; |
858 | | - rt_uint8_t max_priority_in_queue = RT_THREAD_PRIORITY_MAX - 1; |
859 | 832 |
|
860 | 833 | /* parameter check */ |
861 | 834 | RT_ASSERT(mutex != RT_NULL); |
@@ -917,21 +890,6 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) |
917 | 890 | mutex->owner = thread; |
918 | 891 | mutex->original_priority = thread->current_priority; |
919 | 892 |
|
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 | | - |
935 | 893 | if(mutex->hold < RT_MUTEX_HOLD_MAX) |
936 | 894 | { |
937 | 895 | mutex->hold ++; |
|
0 commit comments