Skip to content

Instantly share code, notes, and snippets.

@ohazi
ohazi / queue.h
Last active October 27, 2021 07:56
Single producer, single consumer, lock-free queue
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdatomic.h>
#define NUM_BLOCKS 16
#define BLOCK_SIZE 256
#define SUCCESS 0
#define FAILURE 1