about
12/02/2022
CppBlockingQueue Repo
CppBlockingQueue code

CppBlockingQueue  Repository

Thread-safe queue for transferring messages between threads

Quick Status Code functions correctly no known defects Demonstration code yes Documentation yes - needs more Test cases no Static library no Build requires C++17 option Planned design changes Set copy ctor and assignment oper to =delete
Fig 1. BlockingQueue Diagram
Fig 2. BlockingQueue Class

1.0 Concept

CppBlockingQueue provides a thread-safe message queue that blocks deQuer when empty. It is intended to pass messages between threads in concurrent designs, e.g., asynchronous message-passing communication systems.
This is a small repository holding a single package for this reusable component.

2.0 Implementation

The blocking queue is a template class, implemented using std::mutex and std::condition_variable.

3.0 Build

CppBlockingQueue was built with Visual Studio Community Edition - 2019, and tested on Windows 10.

4.0 Status

I've used CppBlockingQueue in my own designs and students have used it for several years without problems. The class has a copy constructor and copy assignment which I plan to set to delete. as the underlying std::mutex and std::cond_var do not have copy semantics.
  Next Prev Pages Sections About Keys