0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-17 04:50:57 +08:00

zmq::writer_t: Add missing test for swap

This commit is contained in:
Martin Lucina 2010-09-13 13:27:48 +02:00 committed by Martin Sustrik
parent 92f9136ca6
commit be159b6316

View File

@ -309,24 +309,24 @@ void zmq::writer_t::process_activate_writer (uint64_t msgs_read_)
} }
if (!pipe->flush ()) if (!pipe->flush ())
send_activate_reader (reader); send_activate_reader (reader);
}
// There are no more messages in the swap. We can switch into // There are no more messages in the swap. We can switch into
// standard in-memory mode. // standard in-memory mode.
if (swap->empty ()) { if (swap->empty ()) {
swapping = false; swapping = false;
// Push delimiter into the pipe. Trick the compiler to belive that // Push delimiter into the pipe. Trick the compiler to belive that
// the tag is a valid pointer. Note that watermarks are not checked // the tag is a valid pointer. Note that watermarks are not checked
// thus the delimiter can be written even though the pipe is full. // thus the delimiter can be written even though the pipe is full.
if (pending_delimiter) { if (pending_delimiter) {
zmq_msg_t msg; zmq_msg_t msg;
const unsigned char *offset = 0; const unsigned char *offset = 0;
msg.content = (void*) (offset + ZMQ_DELIMITER); msg.content = (void*) (offset + ZMQ_DELIMITER);
msg.flags = 0; msg.flags = 0;
pipe->write (msg, false); pipe->write (msg, false);
flush (); flush ();
return; return;
}
} }
} }