diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-03-09 08:43:20 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-03-09 08:43:20 +0100 |
commit | e04e2cdbbaf351eb04164bdcd293fcb8fa22a9a4 (patch) | |
tree | 419a8ff7db0495de57716d4595dc3d235c6ad6f6 /src/ypipe.hpp | |
parent | 9481c69b0f60068f12aa26699588fed6a8faceec (diff) |
rollback functionality added to pipe
Diffstat (limited to 'src/ypipe.hpp')
-rw-r--r-- | src/ypipe.hpp | 11 |
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. |