RTX: Fixed RTXv5 mutex owner list handling.

The prev-pointer of the running threads mutex list was not set when
multiple mutexes are acquired at a time. This leads to a corrupted list
if the mutexes are not freed in reversed order.

Original commit for CMSIS_5:
commit 729f6ab08540342b7de7612fac103539d5b2f168
Author: Jonatan Antoni <jonatan.antoni@arm.com>
Date:   Wed Apr 19 15:38:43 2017 +0200
pull/4689/head
Bartek Szatkowski 2017-06-27 14:39:34 +01:00 committed by adbridge
parent e161088dc5
commit 1b7a15501c
1 changed files with 3 additions and 0 deletions

View File

@ -187,6 +187,9 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
mutex->owner_thread = runnig_thread; mutex->owner_thread = runnig_thread;
mutex->owner_next = runnig_thread->mutex_list; mutex->owner_next = runnig_thread->mutex_list;
mutex->owner_prev = NULL; mutex->owner_prev = NULL;
if (runnig_thread->mutex_list != NULL) {
runnig_thread->mutex_list->owner_prev = mutex;
}
runnig_thread->mutex_list = mutex; runnig_thread->mutex_list = mutex;
mutex->lock = 1U; mutex->lock = 1U;
EvrRtxMutexAcquired(mutex, mutex->lock); EvrRtxMutexAcquired(mutex, mutex->lock);