template<class T>
class fifo {
public:
- fifo(int limit=0) : max_(limit) {};
+ fifo(size_t limit=0) : max_(limit) {}
bool enq(T, bool blocking=true);
void deq(T *);
bool size() {
lock ml(m_);
return q_.size();
- };
+ }
private:
std::list<T> q_;
mutex m_;
cond non_empty_c_; // q went non-empty
cond has_space_c_; // q is not longer overfull
- unsigned int max_; // maximum capacity of the queue, block enq threads if exceeds this limit
+ size_t max_; // maximum capacity of the queue, block enq threads if exceeds this limit
};
template<class T> bool