|
C++ Concurrency Sandbox
|
Implementation of a thread-safe, bounded blocking queue. More...
#include <iostream>#include <thread>#include <mutex>#include <condition_variable>#include <queue>#include <atomic>Go to the source code of this file.
Classes | |
| class | BoundedBlockingQueue |
| A thread-safe queue with a fixed capacity that supports blocking operations. More... | |
Functions | |
| void | producerTask (BoundedBlockingQueue *q) |
| Worker function for the Producer thread. | |
| void | consumerTask (BoundedBlockingQueue *q) |
| Worker function for the Consumer thread. | |
| int | main () |
| Entry point of the program. Initializes the queue and manages the lifecycle of worker threads. | |
Implementation of a thread-safe, bounded blocking queue.
Definition in file BoundedBlockingQueue.cpp.
| void consumerTask | ( | BoundedBlockingQueue * | q | ) |
Worker function for the Consumer thread.
| q | Pointer to the shared BoundedBlockingQueue. |
Definition at line 123 of file BoundedBlockingQueue.cpp.
References BoundedBlockingQueue::pop(), and BoundedBlockingQueue::shut_down().
Referenced by main().
| int main | ( | void | ) |
Entry point of the program. Initializes the queue and manages the lifecycle of worker threads.
Definition at line 144 of file BoundedBlockingQueue.cpp.
References consumerTask(), and producerTask().
| void producerTask | ( | BoundedBlockingQueue * | q | ) |
Worker function for the Producer thread.
| q | Pointer to the shared BoundedBlockingQueue. |
Definition at line 106 of file BoundedBlockingQueue.cpp.
References BoundedBlockingQueue::push(), and BoundedBlockingQueue::shut_down().
Referenced by main().