[riot-notifications] [RIOT-OS/RIOT] cpu/esp32/freertos: fix semaphore take (#11239)

Gunar Schorcht notifications at github.com
Tue Jul 30 17:14:49 CEST 2019


gschorcht requested changes on this pull request.



> @@ -94,7 +94,7 @@ BaseType_t xSemaphoreTake (SemaphoreHandle_t xSemaphore,
         case queueQUEUE_TYPE_MUTEX:
         {
             if (xTicksToWait == 0) {
-                return (mutex_trylock(mutex) == 0) ? pdTRUE : pdFALSE;
+                return (mutex_trylock(mutex) == 1) ? pdPASS : pdFAIL;

@JulianHolzwarth Don't change the return values. There is no reason for it. According to [API reference](http://www.freertos.org/a00122.html), the return value of xSemaphoreTake is `pdTRUE` and `pdFALSE`.  Even though the values are the same, we should use them as specified to avoid misleadings in future implementations of the FreeRTOS adaptation layer.

> @@ -147,7 +147,7 @@ BaseType_t xSemaphoreTakeRecursive (SemaphoreHandle_t xSemaphore,
     rmutex_t*  rmutex = &((_rmutex_t*)xSemaphore)->rmutex;
 
     if (xTicksToWait == 0) {
-        ret = (rmutex_trylock(rmutex) == 0) ? pdTRUE : pdFALSE;
+        ret = (rmutex_trylock(rmutex) == 1) ? pdPASS : pdFAIL;

The return values should not be changed, see above.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11239#pullrequestreview-268468354
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190730/a8a8dad9/attachment.htm>


More information about the notifications mailing list