]> git.sur5r.net Git - freertos/commitdiff
Ensure a queue or semaphore that is not empty cannot be added to a queue set.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 May 2013 10:11:10 +0000 (10:11 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 May 2013 10:11:10 +0000 (10:11 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1900 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/queue.c
FreeRTOS/Source/tasks.c

index 560049e8989fd9ae4475feb5d93e71b7893af3d2..bdb25271f4f230545a87183a5f54ace920f79be8 100644 (file)
     ***************************************************************************\r
 \r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
     license and Real Time Engineers Ltd. contact details.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
     fully thread aware and reentrant UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems, who sell the code with commercial support,\r
     indemnification and middleware, under the OpenRTOS brand.\r
-    \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
     mission critical applications that require provable dependability.\r
 */\r
 \r
@@ -1855,6 +1855,13 @@ signed portBASE_TYPE xReturn;
 \r
                if( ( ( xQUEUE * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )\r
                {\r
+                       /* Cannot add a queue/semaphore to more than one queue set. */\r
+                       xReturn = pdFAIL;\r
+               }\r
+               else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != 0 )\r
+               {\r
+                       /* Cannot add a queue/semaphore to a queue set if there are already\r
+                       items in the queue/semaphore. */\r
                        xReturn = pdFAIL;\r
                }\r
                else\r
index f892f7caf394981168ae6f11636d5c85d53a04aa..c72239cbca23e1932ae004df93b2ed411d5fbf6e 100644 (file)
@@ -2489,7 +2489,7 @@ tskTCB *pxNewTCB;
                                if( pxNextTCB->ulRunTimeCounter == 0UL )\r
                                {\r
                                        /* The task has used no CPU time at all. */\r
-                                       sprintf( &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t0\t\t0%%\r\n", pxNextTCB->pcTaskName );\r
+                                       sprintf( ( char * ) &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t0\t\t0%%\r\n", pxNextTCB->pcTaskName );\r
                                }\r
                                else\r
                                {\r
@@ -2508,7 +2508,7 @@ tskTCB *pxNewTCB;
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t%u\t\t%u%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
+                                                       sprintf( ( char * ) &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t%u\t\t%u%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
                                                }\r
                                                #endif\r
                                        }\r
@@ -2524,7 +2524,7 @@ tskTCB *pxNewTCB;
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t%u\t\t<1%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter );\r
+                                                       sprintf( ( char * ) &( pcWriteBuffer[ xExistingStringLength ] ), ( char * ) "%s\t\t%u\t\t<1%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter );\r
                                                }\r
                                                #endif\r
                                        }\r