Detecting when running in an ISR ?

Joel Sherrill joel.sherrill at
Wed Mar 28 16:52:34 UTC 2012

On 03/28/2012 10:48 AM, Cudmore, Alan P. (GSFC-5820) wrote:
> On our RTEMS 4.10 project ( m68k/coldfire ), I have an exception handler that does a number of things such as closing files before restarting our processor card.
> This works fine when a task has an exception, but did not work too well when I caught an exception in an ISR.
> I found this macro:
>      _ISR_Is_in_progress
> Which I can use to detect if the exception handler is running in an ISR. Is that a good enough way to detect that the code is running in the context of an ISR? Or is there a better/more standard way?

    bool rtems_interrupt_is_in_progress( void );


> Another option would be to have a high priority exception task running, just waiting to handle the exception clean up activity. The exception handler could use a semaphore to kick off the task.
> Thanks,
> Alan
> _______________________________________________
> rtems-users mailing list
> rtems-users at

Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill at        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list