summaryrefslogtreecommitdiff
path: root/src/pipe.cpp
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/pipe.cpp
parent9481c69b0f60068f12aa26699588fed6a8faceec (diff)
rollback functionality added to pipe
Diffstat (limited to 'src/pipe.cpp')
-rw-r--r--src/pipe.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp
index a8e7bb9..e738128 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -146,6 +146,19 @@ bool zmq::writer_t::write (zmq_msg_t *msg_)
// TODO: Adjust size of the pipe.
}
+void zmq::writer_t::rollback ()
+{
+ while (true) {
+ zmq_msg_t msg;
+ if (!pipe->unwrite (&msg))
+ break;
+ zmq_msg_close (&msg);
+ }
+
+ // TODO: We don't have to inform the reader side of the pipe about
+ // the event. We'll simply adjust the pipe size and keep calm.
+}
+
void zmq::writer_t::flush ()
{
if (!pipe->flush ())