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/pipe.cpp | |
parent | 9481c69b0f60068f12aa26699588fed6a8faceec (diff) |
rollback functionality added to pipe
Diffstat (limited to 'src/pipe.cpp')
-rw-r--r-- | src/pipe.cpp | 13 |
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 ()) |