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.

RTOS/66AK2H12: Thread (Task) join ?

Part Number: 66AK2H12

Tool/software: TI-RTOS

SYS/BIOS 6.50, XDCtools 3.50, CCS 7.2, xdc.useModule('ti.sysbios.knl.Task');

I have some requirements where I need to wait for a task to terminate. I can't locate a simple join like function to accomplish this. I see that there are task hooks I can set up statically in the cfg but it seems quite involved to accomplish a simple join like mechanism. Am I missing something obvious and if not or hooks are required, can I get some example that demonstrates a join implementation?

Mike

  • Expanding some here on what I am trying to do. I've got two cases:
    1) I have a created task handle, I've woke that task signalling it to finish its work and now I want to wait until it terminated. This is where a join() like function would be helpful. Maybe since I have the task handle I can check its status? [how long to handles to terminated threads hang around!?]
    2) I've got tasks that runs to completion and that I am not monitoring it or can't wait around on it to finish. (might be worker threads or slow threads waiting on asynchronous IO)

    In both cases, I do need to delete the task using Task_delete() right? Otherwise I've got a memory leak?

    If I try to use an Exit hook function, can the task delete itself?
  • I've forwarded your query to the TI-RTOS experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • Hi Mike,

    There are a couple of options you can try.    You could set Task.deleteTerminatedTasks = true in the .cfg file.  With this configuration, the idle task will free up terminated tasks.

    Looking at the Task_exit() code, it doesn’t look like you should delete the task in the Task exit hook function.  The task handle is still referenced in kernel code after the exit hook is called.

    There is also a solution in this thread:

    Best regards,

    Janet