LeetCode 1188. Design Bounded Blocking Queue
Problem Description The problem asked us to imlement a thread safer bounded blocking queues with following methods.
Constructor enqueue dequeue size The implementation will be tested under multi-threaded condition. Each thread will either be a producer (calling enqueue) or a consumer(calling dequeue).
Intuition C++ offers us multiple ways of implementing the thread safe mechanism. The Conditional variable and the mutex locks can be a
Approach Complexity Code Our solution using condition variable and mutex can be seen below.