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/CC3200: Need to pause or stop executing a particular thread from other thread or ISR.

Part Number: CC3200
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi,

Let's say I have 2 threads, Thread 1 and Thread 2 and one HWI.

Thread 1 is performing mqtt client task along with http client. Now I need to use some simplelink api's in order (sl_start -> delay -> accessing file system -> sl_stop -> PRCMMCUReset) whenever an HWI occurs.

For that I'm using Message Queues. When an interrupt is triggered I'm writing a message to a Queue from an ISR and Receiving the messages from Thread 2 and will perform the Above mentioned APIs..

Now I want to know how to stop or disable a specific thread (Thread 1 in this case) from Thread 2 or ISR.

Any help is appreciated.

Regards,

Keshav

  • Keshav,

    I'm assuming Thread 1 and Thread 2 are Tasks?

    If so, you can call Task_setPri() with -1 for the Task that you want to disable.

    Judah

  • Hi,

    Task_setPri() is not defined anywhere in CC3200 sdk and neither in TI-RTOS Documentation.

    Regards,

    Keshav Aggarwal

  • Hi,

    Task_setPri() is a SYSBIOS API.  it can be found under:

    <CORESDK>/docs/tirtos/sysysbios/docs/Bios_APIs.html

    Set a task's priority

    C synopsis target-domain
    Int Task_setPri(Task_Handle handle, Int newpri);
     
    ARGUMENTS
    handle — handle of a previously-created Task instance object
    newpri — task's new priority
    RETURNS
    task's old priority
    DETAILS
    Task_setpri sets the execution priority of task to newpri, and returns that task's old priority value. Raising or lowering a task's priority does not necessarily force preemption and re-scheduling of the caller: tasks in the Mode_BLOCKED mode remain suspended despite a change in priority; and tasks in the Mode_READY mode gain control only if their new priority is greater than that of the currently executing task.
    newpri should be set to a value greater than or equal to 1 and less than or equal to (numPriorities - 1). newpri can also be set to -1 which puts the the task into the INACTIVE state and the task will not run until its priority is raised at a later time by another task. Priority 0 is reserved for the idle task. If newpri equals (numPriorities - 1), execution of the task effectively locks out all other program activity, except for the handling of interrupts.
    The current task can change its own priority (and possibly preempt its execution) by passing the output of self as the value of the task parameter.
    A context switch occurs when calling Task_setpri if a currently running task priority is set lower than the priority of another currently ready task, or if another ready task is made to have a higher priority than the currently running task.
    Task_setpri can be used for mutual exclusion.
    If a task's new priority is different than its previous priority, then its relative placement in its new ready task priority queue can be different than the one it was removed from. This can effect the relative order in which it becomes the running task.
    The effected task is placed at the head of its new priority queue if it is the currently running task. Otherwise it is placed at at the end of its new task priority queue.
    CONSTRAINTS
    newpri must be a value between 1 and (numPriorities - 1) or -1.
    The task cannot be in the Mode_TERMINATED mode.
    The new priority should not be zero (0). This priority level is reserved for the Idle task.