summaryrefslogtreecommitdiff
path: root/src/ypipe.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ypipe.hpp')
-rw-r--r--src/ypipe.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ypipe.hpp b/src/ypipe.hpp
index 26c50ab..225b6a7 100644
--- a/src/ypipe.hpp
+++ b/src/ypipe.hpp
@@ -78,6 +78,17 @@ namespace zmq
#pragma message restore
#endif
+ // Pop an unflushed message from the pipe. Returns true is such
+ // message exists, false otherwise.
+ inline bool unwrite (T *value_)
+ {
+ if (w == &queue.back ())
+ return false;
+ *value_ = queue.back ();
+ queue.unpush ();
+ return true;
+ }
+
// Flush the messages into the pipe. Returns false if the reader
// thread is sleeping. In that case, caller is obliged to wake the
// reader up before using the pipe again.