Don't change owner if take() doesnt succeed (#3987)
This commit is contained in:
parent
4d4a1fde36
commit
c1a7198e7d
@ -193,8 +193,8 @@ bool FreeRTOS::Semaphore::take(std::string owner) {
|
|||||||
} else {
|
} else {
|
||||||
rc = ::xSemaphoreTake(m_semaphore, portMAX_DELAY) == pdTRUE;
|
rc = ::xSemaphoreTake(m_semaphore, portMAX_DELAY) == pdTRUE;
|
||||||
}
|
}
|
||||||
m_owner = owner;
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
m_owner = owner;
|
||||||
log_v("Semaphore taken: %s", toString().c_str());
|
log_v("Semaphore taken: %s", toString().c_str());
|
||||||
} else {
|
} else {
|
||||||
log_e("Semaphore NOT taken: %s", toString().c_str());
|
log_e("Semaphore NOT taken: %s", toString().c_str());
|
||||||
@ -218,8 +218,8 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) {
|
|||||||
} else {
|
} else {
|
||||||
rc = ::xSemaphoreTake(m_semaphore, timeoutMs / portTICK_PERIOD_MS) == pdTRUE;
|
rc = ::xSemaphoreTake(m_semaphore, timeoutMs / portTICK_PERIOD_MS) == pdTRUE;
|
||||||
}
|
}
|
||||||
m_owner = owner;
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
m_owner = owner;
|
||||||
log_v("Semaphore taken: %s", toString().c_str());
|
log_v("Semaphore taken: %s", toString().c_str());
|
||||||
} else {
|
} else {
|
||||||
log_e("Semaphore NOT taken: %s", toString().c_str());
|
log_e("Semaphore NOT taken: %s", toString().c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user