_task_restart not working

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

_task_restart not working

ソリューションへジャンプ
1,247件の閲覧回数
hetul
Contributor I

Hello,

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");

    else

        PRINTF("Task restart error\n");

}

else

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

#endif

  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.

タグ(3)
0 件の賞賛
返信
1 解決策
1,016件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Hetul,

Attached is my example of being able to restart the HeartBeat_Task should anyone else want to test this.

I use a global variable to notify the HVAC_Task when the HeartBeat_Task has been running for 10 loops.  The HVAC_Task will then do a restart of the HeartBeat_Task.

Note this was tested using MQX_4.1.1.

Regards,

David

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,016件の閲覧回数
DavidS
NXP Employee
NXP Employee

​Hi Hetul,

I wonder if the issue is the task never started to run?

What is the priority of the ALIVE_TASK compared to the Main_task?

Regards,

David

0 件の賞賛
返信
1,016件の閲覧回数
hetul
Contributor I

Hello David,

Main_task has priority of 23 and ALIVE_TASK is 10. I previously said the task i'm restarting shows "terminating" after _task_restart but I just notice that it's not the case, Task Status is still active. Thanks for you help David.

0 件の賞賛
返信
1,017件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Hetul,

Attached is my example of being able to restart the HeartBeat_Task should anyone else want to test this.

I use a global variable to notify the HVAC_Task when the HeartBeat_Task has been running for 10 loops.  The HVAC_Task will then do a restart of the HeartBeat_Task.

Note this was tested using MQX_4.1.1.

Regards,

David

0 件の賞賛
返信
1,016件の閲覧回数
hetul
Contributor I

Thank you David.  I tried your way of waiting for task to start for 10 loops and then restarting.  This is working for me.

0 件の賞賛
返信