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.

DSP/Bios TSK Module

Hello all,

              We have an application, where we wanted to create and delete tasks dynamically depending on some events. We had some queries

1) After the task exits or returns (task state is Terminate), will it be automatically deleted (similar to TSK_Delete) and will all the resources used by this particular task be released ?

2) Can we write hooks to TSK_exit() and do a TSK_delete in the hook function ? Is this correct

3) What is the best way to delete tasks which are terminated, so that the resources that these tasks were using will be released for other dynamic entities.

thanks and regafds

  • prasanna um said:
    1) After the task exits or returns (task state is Terminate), will it be automatically deleted (similar to TSK_Delete) and will all the resources used by this particular task be released ?

    My understanding is that TSK_delete is a seperate operation, as TSK_exit in the DSP/BIOS API Guide makes no mention of freeing the resources (which it could not do for a statically defined TSK anyway). Additionally there is a note in the API guide for TSK_delete regarding recommending the task state be TSK_TERMINATED before calling TSK_delete to ensure there is no resource conflict/lockup, since TSK_exit is how the TSK_TERMINATED state is achieved the only way this makes sense is if TSK_exit is not already performing the TSK_delete operation.

    prasanna um said:
    2) Can we write hooks to TSK_exit() and do a TSK_delete in the hook function ? Is this correct

    I suppose you could, but you would have to be careful and put some logic in regarding what tasks should be deleted upon exit. As could mean that every call to TSK_exit calls TSK_delete which could be a problem if you have a task you want to exit but not delete, or if you have a statically defined task that can exit, since a call to TSK_delete on a statically defined task is invalid leading to SYS_error.

    prasanna um said:
    3) What is the best way to delete tasks which are terminated, so that the resources that these tasks were using will be released for other dynamic entities.

    Either putting logic into the TSK_exit application wide exit function to delete the tasks that need to be deleted or to have a master task that is aware of the dynamically created thread status and can call TSK_delete for them when needed.

  • I know this is an old post, but I just ran into this problem. I'm using DSP/BIOS 5.42.1.09. I created an exit function to call TSK_delete(TSK_self()) and discovered that you can't do this. Is there any way for an exiting task to release itself without having to resort to a master cleanup task?