Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 4 months ago.
Is there a way to know if your current context is in an ISR?
I wrote a mailbox adapter that wakes up a consumer thread when mail is pushed, however, in certain cases my mailbox can be full before my consumer thread free's the memory. I want to add something in that yields the current thread, so that my consumer thread is able to free up the mailbox before it returns to my production thread. This approach would not be able to work if the production method is called from the ISR, so I only want to do so if we are not in an ISR context. Is there a way to go about checking this?
1 Answer
5 years, 4 months ago.
I saw some exaples where they read the threadID, if it is 0, you are in an ISR.