I need to answer this question as soon as possible. Please give me your ideas.
Thanks..
question:
The following class is a synchronous circular buffer. It is intended to have a fixed storage size, and it should block the producer thread when full, and the consumer thread when empty.
It makes use of the boost thread library for mutex locking.
Tasks:
• Describe the major problems with this class
• When might you use a class like this.
• Correct the class.
• Show that your solution is correct especially testing boundary conditions.
#pragma once
// This provides uint32_t (although perhaps not on your compiler)
#include <stdint.h>
#include <boost/thread.hpp>
template <typename T, uint32_t max>
class CircularBuffer
{
public: