summaryrefslogtreecommitdiff
path: root/src/ypipe.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-03-09 08:43:20 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-03-09 08:43:20 +0100
commite04e2cdbbaf351eb04164bdcd293fcb8fa22a9a4 (patch)
tree419a8ff7db0495de57716d4595dc3d235c6ad6f6 /src/ypipe.hpp
parent9481c69b0f60068f12aa26699588fed6a8faceec (diff)
rollback functionality added to pipe
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.