Unverified Commit c1a7198e authored by Bascy's avatar Bascy Committed by GitHub

Don't change owner if take() doesnt succeed (#3987)

parent 4d4a1fde
......@@ -193,8 +193,8 @@ bool FreeRTOS::Semaphore::take(std::string owner) {
} else {
rc = ::xSemaphoreTake(m_semaphore, portMAX_DELAY) == pdTRUE;
}
m_owner = owner;
if (rc) {
m_owner = owner;
log_v("Semaphore taken: %s", toString().c_str());
} else {
log_e("Semaphore NOT taken: %s", toString().c_str());
......@@ -218,8 +218,8 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) {
} else {
rc = ::xSemaphoreTake(m_semaphore, timeoutMs / portTICK_PERIOD_MS) == pdTRUE;
}
m_owner = owner;
if (rc) {
m_owner = owner;
log_v("Semaphore taken: %s", toString().c_str());
} else {
log_e("Semaphore NOT taken: %s", toString().c_str());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment