Example #1
0
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;
}
Example #2
0
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);
}
Example #3
0
    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);
	  }
	} 
      }
    }
Example #4
0
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);
}
Example #5
0
  /** 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();
  }