void put(int x) { for(auto i=0;i<x;i++) { unique_lock<mutex> locker(m_mutex); while(Q.full()) empty.wait(locker); assert(!Q.full()); Q.push_back(i); cout << "@ "<< i <<endl; full.notify_all(); } flag = false; }
bool MapsBuffer::pushBack(boost::shared_ptr<const MapsRgb> maps_rgb ) { bool retVal = false; { boost::mutex::scoped_lock buff_lock (bmutex_); if (!buffer_.full ()) retVal = true; buffer_.push_back (maps_rgb); } buff_empty_.notify_one (); return (retVal); }
void scan(std::istream& stream, std::function<void (const std::string &, int, size_t)> fun) { auto line_number = 0; for (std::string line; std::getline(stream, line);) { line_number++; metrics.lines_scanned++; if (line.length() > 0) { buffer.push_back(line); if (buffer.full()) { emit_block(line_number, fun); } } } }
bool PCDBuffer::pushBack (pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloud) { bool retVal = false; { boost::mutex::scoped_lock buff_lock (bmutex_); if (!buffer_.full ()) retVal = true; buffer_.push_back (cloud); } buff_empty_.notify_one (); return (retVal); }
/** Test if the pipe is full This is obviously a volatile value which is constrained by restricted relativity. Note that on some devices it may be costly to implement on the read side (for example on FPGA). */ bool full() const { return cb.full(); }