In some RT kernels, if you want to post to a semaphore or flag from an ISR, you need to call an special version of the method, instead of the regular one called from a normal task. Examples:
xSemaphoreGiveFromISR()
instead ofxSemaphoreGive()
in FreeRTOSisr_PostSem()
instead ofCoPostSem()
in CoOS.
However there are other kernels where this is not needed. For instance:
OSSemPost()
in uC/OS can be called both from tasks and ISRs.release()
in mbed-rtos, can be called from Threads and ISRs.semGive()
in VxWorks seems to be callable from an ISR according to the docs, and at first glance no special method exists for ISRs.
Why would you need to create special versions? I understand that the posting of a semaphore or flag might cause a blocked task of higher priority to be awaken. And that's why the scheduler is most likely going to run when the ISR exit callback is called (I'm talking about those functions needed to be called when you want to use kernel code inside the ISR, like portEXIT_SWITCHING_ISR()
in FreeRTOS, or OSIntExit
in uC/OS). So why the special post method in addition to the ISRexit call?