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 delete question

Guru 24520 points
Part Number: AM5726


Tool/software: TI-RTOS

Hi TI Experts,

Please let me confirm the following question.

[Question]
If delete or destruct the Task A which is waiting the semaphore flag of Sem A, what will be happen for Sem A?
**Customer would like to know the handling about Resources secured by the deleted task.

If you have any question, please let me know.
Best regards.
Kaka

  • Hi Kaka,

    When a blocked Task is deleted, it will be removed from the pendQ of the Semaphore. So, if the Semaphore is posted in the future, its count will increment.

    Best,
    Ashish
  • Hi Ashish,

    Thank you for your answers.
    I think that if a blocked task is deleted, the resource which task get will not release.
    And if semaphore is post and the blocked Task did not run by priority even though get the semaphore and then delete this task, the semaphore continue to get the resource.
    Is my understanding correct?

    Best regards.
    Kaka
  • Hi Kaka,

    >> I think that if a blocked task is deleted, the resource which task get will not release.

    Yes, that is correct. The resource will not be automatically freed by the kernel.

    >> And if semaphore is post and the blocked Task did not run by priority even though get the semaphore and then delete this task, the semaphore continue to get the resource.
    Is my understanding correct?

    I am sorry but I did not understand the question. Could you explain it again ?

    Best,
    Ashish
  • Hi Ashish,

    I apologize for your confusion and my poor English skill.
    If user meet the following process, is the following result as the expected operation of TI - RTOS ?
    1. Task A is waiting the semaphore (i.e. Pend)
    2. Task B release the semaphore (i.e. Post)
    3. Task C is higher priority than Task A (i.e. Task A cannot be running)
    4. Change the Task A priority to inactive
    5. As a result, Task A will be inactive with having the resource(semaphore)

    Best regards.
    Kaka
  • Yes, that is correct assuming the Semaphore is a binary semaphore guarding a resource. In the scenario you shared, Task A would own the resource until it is made active again and explicitly posts the Semaphore to release the resource.

    Best,
    Ashish
  • Hi Ashish,

    Thank you for your answer! It is very helpful for me.

    Best regards.
    Kaka