void receiver() { int n; do { n = buf.receive(); std::cout << "received: " << n << std::endl; } while (n != -1); // -1 indicates end of buffer }
void receiver() { int n; do { n = buf.receive(); { boost::mutex::scoped_lock io_lock(io_mutex); std::cout << "received: " << n << std::endl; } } while (n != -1); // -1 indicates end of buffer }
void receiver() { int n; do { n = buf.receive(); if(!(n%10000)) { boost::unique_lock<boost::mutex> io_lock(io_mutex); std::cout << "received: " << n << std::endl; } } while (n != -1); // -1 indicates end of buffer buf.send(-1); }