From f2ff2c6e5c4e244dea28e1ac6ec3f886b7ebc356 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 30 Sep 2009 10:08:35 +0200 Subject: checking for available messages added to ypipe/pipe --- src/pipe.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/pipe.cpp') diff --git a/src/pipe.cpp b/src/pipe.cpp index f8dfcb8..e444520 100644 --- a/src/pipe.cpp +++ b/src/pipe.cpp @@ -36,6 +36,17 @@ zmq::reader_t::~reader_t () { } +bool zmq::reader_t::check_read () +{ + // Check if there's an item in the pipe. + if (pipe->check_read ()) + return true; + + // If not, deactivate the pipe. + endpoint->kill (this); + return false; +} + bool zmq::reader_t::read (zmq_msg_t *msg_) { if (!pipe->read (msg_)) { -- cgit v1.2.3