Skip to content

Commit e7e2653

Browse files
authored
Update FreeRTOS.cpp
1 parent a6bbf24 commit e7e2653

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp_utils/FreeRTOS.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,22 @@ uint32_t FreeRTOS::getTimeSinceStart() {
6767
*/
6868
uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
6969
ESP_LOGV(LOG_TAG, ">> wait: Semaphore waiting: %s for %s", toString().c_str(), owner.c_str());
70+
71+
m_owner = owner;
7072

7173
if (m_usePthreads) {
7274
pthread_mutex_lock(&m_pthread_mutex);
7375
} else {
7476
xSemaphoreTake(m_semaphore, portMAX_DELAY);
7577
}
7678

77-
m_owner = owner;
78-
7979
if (m_usePthreads) {
8080
pthread_mutex_unlock(&m_pthread_mutex);
8181
} else {
8282
xSemaphoreGive(m_semaphore);
8383
}
8484

8585
ESP_LOGV(LOG_TAG, "<< wait: Semaphore released: %s", toString().c_str());
86-
m_owner = std::string("<N/A>");
8786
return m_value;
8887
} // wait
8988

@@ -93,7 +92,8 @@ FreeRTOS::Semaphore::Semaphore(std::string name) {
9392
if (m_usePthreads) {
9493
pthread_mutex_init(&m_pthread_mutex, nullptr);
9594
} else {
96-
m_semaphore = xSemaphoreCreateMutex();
95+
m_semaphore = xSemaphoreCreateBinary();
96+
xSemaphoreGive(m_semaphore);
9797
}
9898

9999
m_name = name;

0 commit comments

Comments
 (0)