mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4685 from kegilbert/running-thread-typo-fix
Rename runnig_thread to running_thread in rtx_mutexpull/4678/merge
commit
036778b64e
|
@ -161,10 +161,10 @@ const char *svcRtxMutexGetName (osMutexId_t mutex_id) {
|
||||||
/// \note API identical to osMutexAcquire
|
/// \note API identical to osMutexAcquire
|
||||||
osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
|
osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
|
||||||
os_mutex_t *mutex = (os_mutex_t *)mutex_id;
|
os_mutex_t *mutex = (os_mutex_t *)mutex_id;
|
||||||
os_thread_t *runnig_thread;
|
os_thread_t *running_thread;
|
||||||
|
|
||||||
runnig_thread = osRtxThreadGetRunning();
|
running_thread = osRtxThreadGetRunning();
|
||||||
if (runnig_thread == NULL) {
|
if (running_thread == NULL) {
|
||||||
EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
|
EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
|
||||||
return osError;
|
return osError;
|
||||||
}
|
}
|
||||||
|
@ -184,20 +184,20 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
|
||||||
// Check if Mutex is not locked
|
// Check if Mutex is not locked
|
||||||
if (mutex->lock == 0U) {
|
if (mutex->lock == 0U) {
|
||||||
// Acquire Mutex
|
// Acquire Mutex
|
||||||
mutex->owner_thread = runnig_thread;
|
mutex->owner_thread = running_thread;
|
||||||
mutex->owner_next = runnig_thread->mutex_list;
|
mutex->owner_next = running_thread->mutex_list;
|
||||||
mutex->owner_prev = NULL;
|
mutex->owner_prev = NULL;
|
||||||
if (runnig_thread->mutex_list != NULL) {
|
if (running_thread->mutex_list != NULL) {
|
||||||
runnig_thread->mutex_list->owner_prev = mutex;
|
running_thread->mutex_list->owner_prev = mutex;
|
||||||
}
|
}
|
||||||
runnig_thread->mutex_list = mutex;
|
running_thread->mutex_list = mutex;
|
||||||
mutex->lock = 1U;
|
mutex->lock = 1U;
|
||||||
EvrRtxMutexAcquired(mutex, mutex->lock);
|
EvrRtxMutexAcquired(mutex, mutex->lock);
|
||||||
return osOK;
|
return osOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Mutex is recursive and running Thread is the owner
|
// Check if Mutex is recursive and running Thread is the owner
|
||||||
if ((mutex->attr & osMutexRecursive) && (mutex->owner_thread == runnig_thread)) {
|
if ((mutex->attr & osMutexRecursive) && (mutex->owner_thread == running_thread)) {
|
||||||
// Increment lock counter
|
// Increment lock counter
|
||||||
if (mutex->lock == osRtxMutexLockLimit) {
|
if (mutex->lock == osRtxMutexLockLimit) {
|
||||||
EvrRtxMutexError(mutex, osRtxErrorMutexLockLimit);
|
EvrRtxMutexError(mutex, osRtxErrorMutexLockLimit);
|
||||||
|
@ -213,14 +213,14 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
|
||||||
// Check if Priority inheritance protocol is enabled
|
// Check if Priority inheritance protocol is enabled
|
||||||
if (mutex->attr & osMutexPrioInherit) {
|
if (mutex->attr & osMutexPrioInherit) {
|
||||||
// Raise priority of owner Thread if lower than priority of running Thread
|
// Raise priority of owner Thread if lower than priority of running Thread
|
||||||
if (mutex->owner_thread->priority < runnig_thread->priority) {
|
if (mutex->owner_thread->priority < running_thread->priority) {
|
||||||
mutex->owner_thread->priority = runnig_thread->priority;
|
mutex->owner_thread->priority = running_thread->priority;
|
||||||
osRtxThreadListSort(mutex->owner_thread);
|
osRtxThreadListSort(mutex->owner_thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EvrRtxMutexAcquirePending(mutex, timeout);
|
EvrRtxMutexAcquirePending(mutex, timeout);
|
||||||
// Suspend current Thread
|
// Suspend current Thread
|
||||||
osRtxThreadListPut((os_object_t*)mutex, runnig_thread);
|
osRtxThreadListPut((os_object_t*)mutex, running_thread);
|
||||||
osRtxThreadWaitEnter(osRtxThreadWaitingMutex, timeout);
|
osRtxThreadWaitEnter(osRtxThreadWaitingMutex, timeout);
|
||||||
return osErrorTimeout;
|
return osErrorTimeout;
|
||||||
}
|
}
|
||||||
|
@ -237,11 +237,11 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
|
||||||
os_mutex_t *mutex = (os_mutex_t *)mutex_id;
|
os_mutex_t *mutex = (os_mutex_t *)mutex_id;
|
||||||
os_mutex_t *mutex0;
|
os_mutex_t *mutex0;
|
||||||
os_thread_t *thread;
|
os_thread_t *thread;
|
||||||
os_thread_t *runnig_thread;
|
os_thread_t *running_thread;
|
||||||
int8_t priority;
|
int8_t priority;
|
||||||
|
|
||||||
runnig_thread = osRtxThreadGetRunning();
|
running_thread = osRtxThreadGetRunning();
|
||||||
if (runnig_thread == NULL) {
|
if (running_thread == NULL) {
|
||||||
EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
|
EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
|
||||||
return osError;
|
return osError;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if running Thread is not the owner
|
// Check if running Thread is not the owner
|
||||||
if (mutex->owner_thread != runnig_thread) {
|
if (mutex->owner_thread != running_thread) {
|
||||||
EvrRtxMutexError(mutex, osRtxErrorMutexNotOwned);
|
EvrRtxMutexError(mutex, osRtxErrorMutexNotOwned);
|
||||||
return osErrorResource;
|
return osErrorResource;
|
||||||
}
|
}
|
||||||
|
@ -286,13 +286,13 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
|
||||||
if (mutex->owner_prev != NULL) {
|
if (mutex->owner_prev != NULL) {
|
||||||
mutex->owner_prev->owner_next = mutex->owner_next;
|
mutex->owner_prev->owner_next = mutex->owner_next;
|
||||||
} else {
|
} else {
|
||||||
runnig_thread->mutex_list = mutex->owner_next;
|
running_thread->mutex_list = mutex->owner_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore running Thread priority
|
// Restore running Thread priority
|
||||||
if (mutex->attr & osMutexPrioInherit) {
|
if (mutex->attr & osMutexPrioInherit) {
|
||||||
priority = runnig_thread->priority_base;
|
priority = running_thread->priority_base;
|
||||||
mutex0 = runnig_thread->mutex_list;
|
mutex0 = running_thread->mutex_list;
|
||||||
while (mutex0) {
|
while (mutex0) {
|
||||||
// Mutexes owned by running Thread
|
// Mutexes owned by running Thread
|
||||||
if ((mutex0->thread_list != NULL) && (mutex0->thread_list->priority > priority)) {
|
if ((mutex0->thread_list != NULL) && (mutex0->thread_list->priority > priority)) {
|
||||||
|
@ -301,7 +301,7 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
|
||||||
}
|
}
|
||||||
mutex0 = mutex0->owner_next;
|
mutex0 = mutex0->owner_next;
|
||||||
}
|
}
|
||||||
runnig_thread->priority = priority;
|
running_thread->priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Thread is waiting for a Mutex
|
// Check if Thread is waiting for a Mutex
|
||||||
|
|
Loading…
Reference in New Issue