Skip to content

Instantly share code, notes, and snippets.

View PavelTrushkin's full-sized avatar

PavelTrushkin

View GitHub Profile
@PavelTrushkin
PavelTrushkin / queue.hpp
Created August 3, 2021 20:12 — forked from Kuxe/queue.hpp
C++ implementation of a general semaphore and a thread-safe circular queue
#ifndef QUEUE_HPP
#define QUEUE_HPP
#include <cstdio>
#include "semaphore.hpp"
/** A thread-safe queue which supports one read-thread and one write-thread
manipulating the queue concurrently. In other words, the thread-safe queue can
be used in the consumer-producer problem with one consumer and one producer. **/
template<typename T>