I'm developing a small embedded system on an ARM microcontroller WITHOUT AN OPERATING SYSTEM. It has several different types of interrupts occurring (button presses, A to D conversion, timer - etc.) and just a single thread running.
I want to have a FIFO queue of events to process where each interrupt service routine adds it's event to the queue and the main (and only) thread removes the events from the queue to process. Clearly accessing the queue data structure in the interrupt service routine is dangerous, but a spinlock will cause deadlock since if the main thread has the lock and an interrupt occurs, the ISR will wait forever for the lock.
Of course, I know already that I can disable interrupts while the main thread is messing around with the queue, but this is not ideal.
What is the best way to proceed here?
Thanks A