9 zmq::reaper_t::reaper_t (
class ctx_t *ctx_, uint32_t tid_) :
10 object_t (ctx_, tid_),
11 _mailbox_handle (static_cast<poller_t::handle_t> (
NULL)),
16 if (!_mailbox.valid ())
19 _poller =
new (std::nothrow) poller_t (*ctx_);
23 _mailbox_handle = _poller->add_fd (_mailbox.get_fd (),
this);
24 _poller->set_pollin (_mailbox_handle);
32 zmq::reaper_t::~reaper_t ()
37 zmq::mailbox_t *zmq::reaper_t::get_mailbox ()
47 _poller->start (
"Reaper");
50 void zmq::reaper_t::stop ()
52 if (get_mailbox ()->valid ()) {
57 void zmq::reaper_t::in_event ()
69 const int rc = _mailbox.recv (&cmd, 0);
77 cmd.destination->process_command (cmd);
81 void zmq::reaper_t::out_event ()
86 void zmq::reaper_t::timer_event (
int)
91 void zmq::reaper_t::process_stop ()
98 _poller->rm_fd (_mailbox_handle);
103 void zmq::reaper_t::process_reap (socket_base_t *socket_)
106 socket_->start_reaping (_poller);
111 void zmq::reaper_t::process_reaped ()
117 if (!_sockets && _terminating) {
119 _poller->rm_fd (_mailbox_handle);