Can i use POSIX API in interrupt handling?

Hi,I am confused and I’ve looked at the source code,I’m still not sure if I can use the POSIX API in interrupts.please tell me and why?

You can use any API from interrupts. Just bear in mind that if you make calls to the FreeRTOS API you should call the *FromISR version of the function. Also any call you make you have to be sure that it is non-blocking as otherwise your interrupt service routine may prevent anything else in the system from happening.

Thank you for the response.
As you said,my project use *FromISR version of the function in interrupt handling.but now i want to use FreeRTOS+POSIX, I’m not sure if the POSIX API can also be used in interrupts .
For example, mq_timedreceive() is used to receive data in a message queue,but it seems to work only in threads not interrupts.

Sorry, I forgot about the FreeRTOS+POSIX labs library. Because the POSIX interfaces have no way of knowing whether they have been called from ISR or from a task they are not compatible with calls from ISRs.

OK, So the conclusion is that I can’t use the POSIX API in interrupts.
Best wishes for you.

No, I don’t think that is the conclusion, it would depend on the API you are wanting to call. You would have to look at its implementation to see what it was doing and what it was calling.

  • For example, obviously I can’t use mq_timedreceive API in interrupts.Because it uses xSemaphoreTake and xQueueReceive,not *FromISR.