Forráskód Böngészése

Fix functions broken by nested mutex feature

tangzz98 3 éve
szülő
commit
3e2191ea62
1 módosított fájl, 16 hozzáadás és 2 törlés
  1. 16 2
      FreeRTOS/queue.c

+ 16 - 2
FreeRTOS/queue.c

@@ -569,7 +569,14 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
 
     if ( type == RT_Object_Class_Mutex )
     {
-        uxReturn = ( ( rt_mutex_t ) pipc )->value;
+        if ( ( ( rt_mutex_t ) pipc )->owner == RT_NULL )
+        {
+            uxReturn = 1;
+        }
+        else
+        {
+            uxReturn = 0;
+        }
     }
     else if ( type == RT_Object_Class_Semaphore )
     {
@@ -603,7 +610,14 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
 
     if ( type == RT_Object_Class_Mutex )
     {
-        uxReturn = 1 - ( ( rt_mutex_t ) pipc )->value;
+        if ( ( ( rt_mutex_t ) pipc )->owner == RT_NULL )
+        {
+            uxReturn = 0;
+        }
+        else
+        {
+            uxReturn = 1;
+        }
     }
     else if ( type == RT_Object_Class_Semaphore )
     {