12 zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
13 object_t (ctx_, tid_),
14 _mailbox_handle (static_cast<poller_t::handle_t> (
NULL))
16 _poller =
new (std::nothrow) poller_t (*ctx_);
20 _mailbox_handle =
_poller->add_fd (_mailbox.get_fd (),
this);
21 _poller->set_pollin (_mailbox_handle);
25 zmq::io_thread_t::~io_thread_t ()
34 get_tid () - zmq::ctx_t::reaper_tid - 1);
36 _poller->start (
name);
39 void zmq::io_thread_t::stop ()
44 zmq::mailbox_t *zmq::io_thread_t::get_mailbox ()
49 int zmq::io_thread_t::get_load ()
const
51 return _poller->get_load ();
54 void zmq::io_thread_t::in_event ()
60 int rc = _mailbox.recv (&cmd, 0);
64 cmd.destination->process_command (cmd);
65 rc = _mailbox.recv (&cmd, 0);
71 void zmq::io_thread_t::out_event ()
77 void zmq::io_thread_t::timer_event (
int)
83 zmq::poller_t *zmq::io_thread_t::get_poller ()
const
89 void zmq::io_thread_t::process_stop ()
92 _poller->rm_fd (_mailbox_handle);