Instantly share code, notes, and snippets.

View ProducerConsumerQueue.c
#define LEN 20
void volatile* raw_queue[LEN];
int volatile reader_ctr = 0;
int volatile writer_ctr = 0;
_Bool push_packet(void* pointer) {
ASSERT(pointer != NULL);
bool result = false;
DISABLED_INTERRUPTS(
int nextElement = (writer_ctr + 1) % LEN;