Search code examples
cinterrupt

Can interrupts be handled in standard C?


Is there a method of servicing hardware interrupts in standard C (ANSI/ISO)? All the implementations Ive seen so far either use compiler specific language extensions or pre-processor directives.

I just came across the standard C library 'signals' feature, but wikipedia is very light on its use and I dont think it serves the purpose.


Solution

  • At some point your implementation will have to interface with some standard outside of the C spec, whether that's Linux's family of types and function signatures that define interrupt handlers, a similar body of C code built up for another operating system, or maybe the hardware spec for an embedded platform that would allow you to implement your own. If you can clarify your goal, it might be possible to give a more specific answer.