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/pipe.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/pipe.cpp') 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 ()) -- cgit v1.2.3