AnsweredAssumed Answered

how to destroy only one task

Question asked by sudhakar p on Apr 1, 2015
Latest reply on Apr 7, 2015 by soledad

hi..

now i am working on frdmk64 controller. actually i edited hello example project. in this project i created 3 task but i want to destroy one task after some time but its destroyed all task. i attached my code also.

 

sample code:

const TASK_TEMPLATE_STRUCT  MQX_template_list[] =

{

   /* Task Index,   Function,   Stack,  Priority, Name,     Attributes,          Param, Time Slice */

    { WORLD_TASK,   world_task, 700,   8,        "world",  MQX_AUTO_START_TASK, 0,     0 },

    { HELLO_TASK,   hello_task, 700,   9,        "hello",  MQX_AUTO_START_TASK, 0,     0 },

    { TEST_TASK,  test_task, 700,   10,        "test",  0, 0,     0 },

    { 0 }

};

 

 

test_tid = _task_create(0, TEST_TASK, (uint32_t) &task_p);

                if (test_tid == MQX_NULL_TASK_ID)

                 {

                      fprintf(stderr, "Fatal Error 0x%X: Unable to create test  task.", _task_get_error());

                   _task_block();

                  }

i=10;

while(1)

    {

        printf("Enter\n",i);

      

                printf("world=%d\n",i);

              

                 if(i==15)

                 {

                    _task_destroy(test_tid);

                     printf("test destroyed",i);                  

                 }

                i++;

            _time_delay(3000);

 

    }

 

my problem was its blocking WORLD_TASK and also HELLO_TASK. so how to solve this problem.

 

Original Attachment has been moved to: hello_pro.zip

Outcomes