3

/*9*/ template<class Alloc, class = std::enable_if_t<std::uses_allocator_v<Container, Alloc>>> BlockingQueue(const BlockingQueue& other, const Alloc& alloc) : queue_(alloc) { auto lock{std::scoped_lock(other.mutex_)}; queue_ = other.queue_; } This doesn't look quite right. queue_ = other.queue; may cause the ...


2

Actually, the initial producer-consumer scheme is over-complicated and has the following issues: Using 2 separate threading.Semaphore objects: One of them is used for producer (remaining_space), another - for consumer (fill_count). Though they won't be convenient here (as I'll describe below), but for your future potential cases, a better naming would be ...


1

If the only requirement is to have two threads, one printing even numbers and other printing odd numbers, then your solution is unnecessarily complicated. The fact that you share the same data model for both threads forces you to synchronize access to the object making the solution unnecessarily complicated. The assignment did not require numbers being ...


Only top voted, non community-wiki answers of a minimum length are eligible