]> git.sur5r.net Git - freertos/commitdiff
Added INCLUDE_xQueueGetMutexHolder macro.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 17 May 2012 08:22:27 +0000 (08:22 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 17 May 2012 08:22:27 +0000 (08:22 +0000)
Removed the "-rc1" that was accidentally left on the version number of some Win32 port files.
Changed the behaviour of xQueueGenericReset() so queues can be reset when tasks are blocked on them.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1751 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/include/FreeRTOS.h
Source/portable/MSVC-MingW/port.c
Source/portable/MSVC-MingW/portmacro.h
Source/queue.c

index 6c5e227d603d8dbaa5e8e0b6ae44f90ece1803c2..fb31e736cab37be2e15a24159c6dd5d3b9218c6a 100644 (file)
@@ -149,6 +149,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
        #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0\r
 #endif\r
 \r
+#ifndef INCLUDE_xQueueGetMutexHolder\r
+       #define INCLUDE_xQueueGetMutexHolder 0\r
+#endif\r
+\r
 #ifndef INCLUDE_pcTaskGetTaskName\r
        #define INCLUDE_pcTaskGetTaskName 0\r
 #endif\r
index 952817f6814eee96e5211048e3c8cff5ccf59a78..a13e68fbfe43829fd73e5d9df132533b2a17910b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+    FreeRTOS V7.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
        \r
 \r
     ***************************************************************************\r
index 6de3c1f939837e7ce2d1edf20cd4ac2aa8be7dc0..813aa732e9d69b2ebf224a1d894ce7dd2c0bfd5a 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+    FreeRTOS V7.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
        \r
 \r
     ***************************************************************************\r
index 355131c0dcfe7b54173866508f9025ea50cb95c6..5faea1d2d3b1c30f54e1c5531993ea051ccdbfac 100644 (file)
@@ -278,26 +278,9 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
 \r
 portBASE_TYPE xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue )\r
 {\r
-portBASE_TYPE xReturn = pdPASS;\r
-\r
        configASSERT( pxQueue );\r
 \r
-       /* If the queue being reset has already been used (has not just been\r
-       created), then only reset the queue if its event lists are empty. */\r
-       if( xNewQueue != pdTRUE )\r
-       {\r
-               if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )\r
-               {\r
-                       xReturn = pdFAIL;\r
-               }\r
-\r
-               if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )\r
-               {\r
-                       xReturn = pdFAIL;\r
-               }\r
-       }\r
-\r
-       if( xReturn == pdPASS )\r
+       taskENTER_CRITICAL();\r
        {\r
                pxQueue->pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize );\r
                pxQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;\r
@@ -306,12 +289,33 @@ portBASE_TYPE xReturn = pdPASS;
                pxQueue->xRxLock = queueUNLOCKED;\r
                pxQueue->xTxLock = queueUNLOCKED;\r
 \r
-               /* Ensure the event queues start with the correct state. */\r
-               vListInitialise( &( pxQueue->xTasksWaitingToSend ) );\r
-               vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );\r
+               if( xNewQueue == pdFALSE )\r
+               {\r
+                       /* If there are tasks blocked waiting to read from the queue, then \r
+                       the tasks will remain blocked as after this function exits the queue \r
+                       will still be empty.  If there are tasks blocked waiting to     write to \r
+                       the queue, then one should be unblocked as after this function exits \r
+                       it will be possible to write to it. */\r
+                       if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )\r
+                       {\r
+                               if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE )\r
+                               {\r
+                                       portYIELD_WITHIN_API();\r
+                               }\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       /* Ensure the event queues start in the correct state. */\r
+                       vListInitialise( &( pxQueue->xTasksWaitingToSend ) );\r
+                       vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );                \r
+               }\r
        }\r
+       taskEXIT_CRITICAL();\r
 \r
-       return xReturn;\r
+       /* A value is returned for calling semantic consistency with previous\r
+       versions. */\r
+       return pdPASS;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -425,7 +429,7 @@ xQueueHandle xReturn = NULL;
 #endif /* configUSE_MUTEXES */\r
 /*-----------------------------------------------------------*/\r
 \r
-#if ( configUSE_MUTEXES == 1 )\r
+#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xQueueGetMutexHolder == 1 ) )\r
 \r
        void* xQueueGetMutexHolder( xQueueHandle xSemaphore )\r
        {\r
@@ -1024,7 +1028,6 @@ signed char *pcOriginalReadPosition;
                                                        portYIELD_WITHIN_API();\r
                                                }\r
                                        }\r
-\r
                                }\r
 \r
                                taskEXIT_CRITICAL();\r