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.

Task restart

Other Parts Discussed in Thread: SYSBIOS

Hello,

what is the best method to restart static tasks in SYSBIOS (by using external function, not inside the task itself)? I would like to restart tasks from the timer Hwi level. If some task is not responding for a given time (not resetting timeout counter), it should be restarted.

I need this feature for some tasks that can hangout, e.g. USB MSC host task, which is used to copy log information into the pendrive. This task hangs on the USBHCDPipeRead function (inside usblib) when the pendrive is removed during access. 

Regards,

Kamil

  • Kamil,

    I'm curious as to what state the task is in, do you know?

    There is no "Task_restart" function.  One method I can think of is for you to create the Task at runtime so you can delete it and create it again.  Would that be a viable solution?  Statically created tasks are not deleteable although you might be able to call Task_destruct() and then Task_construct() on it.

    Judah

  • Hi Judah,

    thank you for a quick answer.

    I have found the while loop inside usblib where the driver was hanging after pendrive removal during access. I set a flag there and break the loop. Next, the flag is used for "exception throwing" (to break operation of the entire driver).

    Next, the driver is restarted from the thread level. Thus, restarting of the threads is not crucial at the moment. Moreover, I have found, that not only the usb driver has to be restarted, but also some driver's variables need to be reinitialized.

    I have one more question to the subject - How much more memory consuming are the dynamic threads? I have certain number of the threads in my system and any overhead for dynamic threading wouldn't be good.

    Regards

    Kamil

     

  • Kamil,

    In fact, creating a Task dynamically really does not consume any more data than creating them statically.  It brings in some additional code for creating the task but other than that, no additional memory is used.

    Judah