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.

Simple question: task calling function... does the funcion inherit the same properties?



Hello, this is simple question, but I would like to be sure that my assumption is right. I have my application developed with DSP/BIOS and several tasks created. I would like to know if I call from one of this tasks to a function (this function was just written appart from the rest of the application, like you would do in a typical C program)  ... does the function work like if its code was copy and pasted inside the task? In other words, does the funcion inherit the properties of the task from where it was called or what?

 

Example:

-Task 1 high priority

-Task 2, low priority,

-Function

 

Task of low priority call to the function. The function is being executed when task 1 (higher priority) wake up. Could task 1 interrupt the function directly, or does the function need to return previously to task2 and then it will be there interrupt from the other task???

 

Thank you in advance

  • James Thorton said:
    does the function work like if its code was copy and pasted inside the task? In other words, does the funcion inherit the properties of the task from where it was called or what?

    If I understand your question correctly the answer is yes, calling functions within a TSK does not change the execution state of the application, i.e. a function called from within a TSK is still considered part of the TSK.

    James Thorton said:
    Task of low priority call to the function. The function is being executed when task 1 (higher priority) wake up. Could task 1 interrupt the function directly, or does the function need to return previously to task2 and then it will be there interrupt from the other task???

    The high priority TSK can always interrupt a lower priority TSK including functions called by that TSK, and when the higher priority TSK blocks again the lower priority TSK will continue where it left off in the function. In general the higher priority TSK will only become unblocked if there is either some hardware interrupt that happens or if the lower priority TSK posts the higher priority TSK, so if you think about it that way the lower priority TSK will always be safe to return to even if it is in the middle of a function called from the original TSK function. See the diagram below for the execution of your proposed example.

  • Thanks a lot for your time, that was a quick answer! Sorry if the question was not very well explained, or it just sounded so simple to be asked, but I wanted to be 100% sure of it. It is just like I was assuming.

     

    Thanks again!