9 fifo(size_t limit=0) : max_(limit) {}
11 bool enq(T e, bool blocking=true) {
13 while (max_ && q_.size() >= max_) {
16 has_space_c_.wait(ml);
19 non_empty_c_.notify_one();
26 non_empty_c_.wait(ml);
29 if (max_ && q_.size() < max_)
30 has_space_c_.notify_one();
37 cond non_empty_c_; // q went non-empty
38 cond has_space_c_; // q is not longer overfull
39 size_t max_; // maximum capacity of the queue, block enq threads if exceeds this limit