Does "xSemaphoreGive" yield to the higher priority task

unknowcoder wrote on Thursday, August 16, 2018:

I am having a weird case where when I give a semaphore the calling task does not yield.

Test Case

  • I have two task A, B.
  • Task A is the highest prioirty task, Task B is lower priority than A.
  • Task A is pending on semaphore “X”.
  • Task B gives semaphore “X”.
  • I have preemption enabled

Given the test case I expect Task B to yield to Task A. As soon as semaphore “X” is given. But this doesn’t seem to be happening. Should I add task taskYIELD() asfter the semaphore is given? Is there anyway to check if the giving the semphore caused the task to yeild?

rtel wrote on Thursday, August 16, 2018:

I’m not sure why you are observing that behaviour and suggest stepping
into the semaphore ‘give’ function (which will map to a queue function)
to see why. It should not be necessary to add in a taskYIELD().

rtel wrote on Thursday, August 16, 2018:

Additionally - In my answer of a few moments ago I am assuming this is
not being called from a critical section or with the scheduler suspended.

unknowcoder wrote on Monday, August 20, 2018:

I have solved it, it was interrupt related had nothing to do with the RTOS.