AnsweredAssumed Answered

_task_restart not working

Question asked by Hetul Patel on Jul 31, 2015
Latest reply on Aug 3, 2015 by Hetul Patel



I am trying to use _task_restart function but when called it hangs the application and I can see in task stack that the task I was trying to restart is in "terminating" state.


For test I modified web_hvac_mqx_twrk64f120m demo and I added following code at line 346 in Main_task().


#if 1    //for task_restart test

_task_id    tempTid;

tempTid = _task_create(0, ALIVE_TASK, 0);

if(tempTid != MQX_NULL_TASK_ID)


    PRINTF("%s tid:%d\n", __FUNCTION__, tempTid);

    tempTid = _task_restart(tempTid, NULL, 0);

    if(tempTid == MQX_OK)

        PRINTF("Task restarted!\n");


        PRINTF("Task restart error\n");



    PRINTF("Could not create the task!\n");



  The mqx config files are with default configuration that it comes with.  Main_task hangs at _task_restart call and I tried to debug it and i can see it's getting hung in _task_restart_func() at line 2441 where it calls _sched_execute_scheduler_internal(). 


Did I not enable a particular MQX module and this is why i'm getting this problem? I appreciate any help.