This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Suspend/restart SysBios task

Other Parts Discussed in Thread: SYSBIOS

What is the best way to suspend and restart a SysBios task?  This would be done by another task which monitors system health.  Is this even possible, or does a task have to be deleted and recreated as if it never existed?  If so, should Task_delete and Task_create be used to restart the task?  What does Task_destruct do (cdoc says 'Finalize the instance object inside the provided structure')?  Is there a way to create a task and start it later?

  • If you want to “restart” a task, yes, you’ll need to delete it, and then recreate it again.  If you used Task_create() to create the task, use Task_delete() to delete it.  Or if you used Task_construct() to create it, use Task_destruct() to delete it.  There is some description of this in Bios_User_Guide.pdf (in the “docs” directory of your SYS/BIOS installation): search for “Creating and Deleting Tasks Dynamically”.  Note especially that resources that are explicitly created by a Task (like a Semaphore) are not automatically deleted when the task itself is deleted.  

    If you simply want to suspend a task and resume it later, then you can control its priority with Task_setPri().  If you want to create a task in an inactive state (meaning it doesn’t automatically run when created), you can create it with priority of “-1”, corresponding to Task_Mode_INACTIVE.  See the “Task Execution States and Scheduling” section of Bios_User_Guide.pdf.

    Scott