From 76e9fe03759ca7e1b4082a556b1bfc06ced31a79 Mon Sep 17 00:00:00 2001 From: RichardBarry Date: Mon, 30 Jul 2007 20:48:12 +0000 Subject: [PATCH] Updates prior to release of V4.4.0 due to testing. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@101 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/AVR32_UC3/main.c | 12 ++++++------ Demo/Common/Minimal/death.c | 31 +++++++++++++------------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Demo/AVR32_UC3/main.c b/Demo/AVR32_UC3/main.c index 4402c4fa3..9427ee43a 100644 --- a/Demo/AVR32_UC3/main.c +++ b/Demo/AVR32_UC3/main.c @@ -274,12 +274,6 @@ portBASE_TYPE bSuicidalTask = 0; /* Delay until it is time to execute again. */ vTaskDelay( mainCHECK_PERIOD ); - /* Delete the dynamically created task. */ - if( xCreatedTask != mainNO_TASK ) - { - vTaskDelete( xCreatedTask ); - } - /* Perform a bit of 32bit maths to ensure the registers used by the integer tasks get some exercise. The result here is not important - see the demo application documentation for more info. */ @@ -300,6 +294,12 @@ portBASE_TYPE bSuicidalTask = 0; /* Toggle the LED if everything is okay. */ vParTestToggleLED( mainCHECK_TASK_LED ); } + + /* Delete the dynamically created task. */ + if( xCreatedTask != mainNO_TASK ) + { + vTaskDelete( xCreatedTask ); + } } } /*-----------------------------------------------------------*/ diff --git a/Demo/Common/Minimal/death.c b/Demo/Common/Minimal/death.c index de9f46b19..d59ffec11 100644 --- a/Demo/Common/Minimal/death.c +++ b/Demo/Common/Minimal/death.c @@ -35,11 +35,11 @@ /** * Create a single persistent task which periodically dynamically creates another - * four tasks. The original task is called the creator task, the four tasks it + * two tasks. The original task is called the creator task, the two tasks it * creates are called suicidal tasks. * - * Two of the created suicidal tasks kill one other suicidal task before killing - * themselves - leaving just the original task remaining. + * One of the created suicidal tasks kill one other suicidal task before killing + * itself - leaving just the original task remaining. * * The creator task must be spawned after all of the other demo application tasks * as it keeps a check on the number of tasks under the scheduler control. The @@ -75,7 +75,7 @@ Changes from V3.1.0 /* Demo program include files. */ #include "death.h" -#define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 24 ) +#define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 60 ) /* The task originally created which is responsible for periodically dynamically creating another four tasks. */ @@ -96,11 +96,11 @@ static volatile unsigned portBASE_TYPE uxTasksRunningAtStart = 0; /* Tasks are deleted by the idle task. Under heavy load the idle task might not get much processing time, so it would be legitimate for several tasks to remain undeleted for a short period. */ -static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 4; +static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 2; -/* Used to store a handle to the tasks that should be killed by a suicidal task, +/* Used to store a handle to the task that should be killed by a suicidal task, before it kills itself. */ -xTaskHandle xCreatedTask1, xCreatedTask2; +xTaskHandle xCreatedTask; /*-----------------------------------------------------------*/ @@ -158,11 +158,10 @@ const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS; { /* Make sure the other task has a go before we delete it. */ vTaskDelay( ( portTickType ) 0 ); + /* Kill the other task that was created by vCreateTasks(). */ - if( xTaskToKill != NULL ) - { - vTaskDelete( xTaskToKill ); - } + vTaskDelete( xTaskToKill ); + /* Kill ourselves. */ vTaskDelete( NULL ); } @@ -183,14 +182,10 @@ unsigned portBASE_TYPE uxPriority; /* Just loop round, delaying then creating the four suicidal tasks. */ vTaskDelay( xDelay ); - xCreatedTask1 = NULL; - xCreatedTask2 = NULL; - - xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID1", deathSTACK_SIZE, NULL, uxPriority, &xCreatedTask1 ); - xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID2", deathSTACK_SIZE, &xCreatedTask1, uxPriority, NULL ); + xCreatedTask = NULL; - xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID1", deathSTACK_SIZE, NULL, uxPriority, &xCreatedTask2 ); - xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID2", deathSTACK_SIZE, &xCreatedTask2, uxPriority, NULL ); + xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID1", configMINIMAL_STACK_SIZE, NULL, uxPriority, &xCreatedTask ); + xTaskCreate( vSuicidalTask, ( signed portCHAR * ) "SUICID2", configMINIMAL_STACK_SIZE, &xCreatedTask, uxPriority, NULL ); ++usCreationCount; } -- 2.39.5