diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-09-18 07:37:36 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-09-18 07:37:36 +0200 |
commit | 4c6d07d3668558d910c9b1d19d52ccdeacc90574 (patch) | |
tree | 3530c8b03e9b475165d8bb3cf2eb425f5bfdd45e /src/fq.cpp | |
parent | fb6ce536d96c82e8f4378a87a5d59aefcc57a96d (diff) |
single term ack counting mechanism for every socket (no separate mechanisms for fq_t and lb_t)
Diffstat (limited to 'src/fq.cpp')
-rw-r--r-- | src/fq.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -22,9 +22,9 @@ #include "fq.hpp" #include "pipe.hpp" #include "err.hpp" -#include "i_terminate_events.hpp" +#include "own.hpp" -zmq::fq_t::fq_t (i_terminate_events *sink_) : +zmq::fq_t::fq_t (own_t *sink_) : active (0), current (0), more (false), @@ -47,8 +47,10 @@ void zmq::fq_t::attach (reader_t *pipe_) active++; // If we are already terminating, ask the pipe to terminate straight away. - if (terminating) + if (terminating) { + sink->register_term_acks (1); pipe_->terminate (); + } } void zmq::fq_t::terminated (reader_t *pipe_) @@ -67,8 +69,8 @@ void zmq::fq_t::terminated (reader_t *pipe_) } pipes.erase (pipe_); - if (terminating && pipes.empty ()) - sink->terminated (); + if (terminating) + sink->unregister_term_ack (); } void zmq::fq_t::terminate () @@ -76,11 +78,7 @@ void zmq::fq_t::terminate () zmq_assert (!terminating); terminating = true; - if (pipes.empty ()) { - sink->terminated (); - return; - } - + sink->register_term_acks (pipes.size ()); for (pipes_t::size_type i = 0; i != pipes.size (); i++) pipes [i]->terminate (); } |