void zmq::writer_t::process_activate_writer (uint64_t msgs_read_) { // Store the reader's message sequence number. msgs_read = msgs_read_; // If we are in the swapping mode, we have some messages in the swap. // Given that pipe is now ready for writing we can move part of the // swap into the pipe. if (swapping) { zmq_msg_t msg; while (!pipe_full () && !swap->empty ()) { swap->fetch(&msg); pipe->write (msg, msg.flags & ZMQ_MSG_MORE); if (!(msg.flags & ZMQ_MSG_MORE)) msgs_written++; } if (!pipe->flush ()) send_activate_reader (reader); // There are no more messages in the swap. We can switch into // standard in-memory mode. if (swap->empty ()) { swapping = false; // Push delimiter into the pipe. Trick the compiler to belive that // the tag is a valid pointer. Note that watermarks are not checked // thus the delimiter can be written even though the pipe is full. if (pending_delimiter) { zmq_msg_t msg; const unsigned char *offset = 0; msg.content = (void*) (offset + ZMQ_DELIMITER); msg.flags = 0; pipe->write (msg, false); flush (); return; } } } // If the writer was non-active before, let's make it active // (available for writing messages to). if (!active && !terminating) { active = true; zmq_assert (sink); sink->activated (this); } }
void zmq::writer_t::flush () { if (!pipe->flush ()) send_activate_reader (reader); }
void zmq::writer_t::flush () { // In the swapping mode, flushing is automatically handled by swap object. if (!swapping && !pipe->flush ()) send_activate_reader (reader); }