11 _matching (0), _active (0), _eligible (0), _more (
false)
26 _pipes.push_back (pipe_);
27 _pipes.swap (_eligible, _pipes.size () - 1);
30 _pipes.push_back (pipe_);
31 _pipes.swap (_active, _pipes.size () - 1);
39 std::size_t claimed_index = _pipes.index (pipe_);
42 if (claimed_index >= _pipes.size ()) {
46 return _pipes[claimed_index] == pipe_;
52 if (_pipes.index (pipe_) < _matching)
56 if (_pipes.index (pipe_) >= _eligible)
60 _pipes.swap (_pipes.index (pipe_), _matching);
76 _pipes.swap (
i, _matching++);
89 if (_pipes.index (pipe_) < _matching) {
90 _pipes.swap (_pipes.index (pipe_), _matching - 1);
93 if (_pipes.index (pipe_) < _active) {
94 _pipes.swap (_pipes.index (pipe_), _active - 1);
97 if (_pipes.index (pipe_) < _eligible) {
98 _pipes.swap (_pipes.index (pipe_), _eligible - 1);
102 _pipes.erase (pipe_);
108 if (_eligible < _pipes.size ()) {
109 _pipes.swap (_pipes.index (pipe_), _eligible);
115 if (!_more && _active < _pipes.size ()) {
116 _pipes.swap (_eligible - 1, _active);
124 return send_to_matching (msg_);
147 if (_matching == 0) {
148 int rc = msg_->
close ();
157 if (!write (_pipes[
i], msg_)) {
163 int rc = msg_->
init ();
170 msg_->
add_refs (
static_cast<int> (_matching) - 1);
175 if (!write (_pipes[
i], msg_)) {
187 const int rc = msg_->
init ();
198 if (!pipe_->write (msg_)) {
199 _pipes.swap (_pipes.index (pipe_), _matching - 1);
201 _pipes.swap (_pipes.index (pipe_), _active - 1);
203 _pipes.swap (_active, _eligible - 1);
215 if (!_pipes[
i]->check_hwm ())