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/AM5726: Task handling questions

Guru 24520 points

Part Number: AM5726
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi TI Experts,

Please let me confirm the following question.

[Question.1]
Would you please teach me the way to confirm the all task handle which user crated?

[Question.2]
Would you please teach me the way to get the number of tasks which user created?

Best regards.
Kaka

  • Hi Kaka,

    What version of SYS/BIOS are you using?

    It's not clear what the first question is asking.

    Todd
  • Hi TODD

    Thank you fot your response .

    They will use the latest Sysbios(6.52.0.12) including the sdk.

    The first question means that they would like to know the all task handle number which user created. Does that t make sense?

    Best regards.

    KAKA

  • Hi Kaka,

    Kaka said:

    [Question.1]

    Would you please teach me the way to confirm the all task handle which user crated?

    [Question.2]
    Would you please teach me the way to get the number of tasks which user created?

    There are 2 different ways to get Task handles for statically and dynamically created Tasks. See "Instance Built-Ins" section of the Task module cdoc: 

     I have also shared some untested C code to do the same below.

    Statically created Tasks:

    #include <xdc/std.h>
    
    #include <ti/sysbios/knl/Task.h>
    
    Void func()
    {
        Int i, numStaticTasks;
        Task_Handle hdl;
    
        numStaticTasks = Task_Object_count(); /* Read total number of statically created Tasks */
    
        for (i = 0; i < numStaticTasks; i++) {
            hdl = Task_Object_get(NULL, i); /* Read Task_Handle of ith statically created Task */
            ...
        }
        ...
    }

    Dynamically created tasks:

    #include <xdc/std.h>
    
    #include <ti/sysbios/knl/Task.h>
    
    Void func()
    {
        Int numDynamicTasks = 0;
        Task_Handle hdl;
    
        hdl = Task_Object_first(); /* Task handle of first dynamically created Task */
        if (hdl != NULL) {
            numDynamicTasks++;
        }
        else {
            return;
        }
    
        while ((hdl = Task_Object_next(hdl)) != NULL) {
            numDynamicTasks++;
        }
    
        ...
    }

    Hope this helps.

    Best,

    Ashish

  • Hi Ashish,

    Thank you for your response. I will inform it to our customer.

    Best regards.
    Kaka