From e04e2cdbbaf351eb04164bdcd293fcb8fa22a9a4 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 9 Mar 2010 08:43:20 +0100 Subject: rollback functionality added to pipe --- src/ypipe.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ypipe.hpp') 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. -- cgit v1.2.3