Lockless FIFO SPSC (Single Producer Single Consumer) Queue in C

For real-time audio processing, it is necessary to communicate to your audio thread in such a way that the audio thread can never be blocked. Audio threads are hard-real-time: any delays will lead to loud pops/crackles/echoes. This is proper engineering! Fun! So here’s my take on a simple C Lockless Single-Producer Single-Consumer queue that can be used for this (and other) applications. This…