io_thread.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_IO_THREAD_HPP_INCLUDED__
4 #define __ZMQ_IO_THREAD_HPP_INCLUDED__
5 
6 #include "stdint.hpp"
7 #include "object.hpp"
8 #include "poller.hpp"
9 #include "i_poll_events.hpp"
10 #include "mailbox.hpp"
11 
12 namespace zmq
13 {
14 class ctx_t;
15 
16 // Generic part of the I/O thread. Polling-mechanism-specific features
17 // are implemented in separate "polling objects".
18 
19 class io_thread_t ZMQ_FINAL : public object_t, public i_poll_events
20 {
21  public:
22  io_thread_t (zmq::ctx_t *ctx_, uint32_t tid_);
23 
24  // Clean-up. If the thread was started, it's necessary to call 'stop'
25  // before invoking destructor. Otherwise the destructor would hang up.
26  ~io_thread_t ();
27 
28  // Launch the physical thread.
29  void start ();
30 
31  // Ask underlying thread to stop.
32  void stop ();
33 
34  // Returns mailbox associated with this I/O thread.
35  mailbox_t *get_mailbox ();
36 
37  // i_poll_events implementation.
38  void in_event ();
39  void out_event ();
40  void timer_event (int id_);
41 
42  // Used by io_objects to retrieve the associated poller object.
43  poller_t *get_poller () const;
44 
45  // Command handlers.
46  void process_stop ();
47 
48  // Returns load experienced by the I/O thread.
49  int get_load () const;
50 
51  private:
52  // I/O thread accesses incoming commands via this mailbox.
53  mailbox_t _mailbox;
54 
55  // Handle associated with mailbox' file descriptor.
56  poller_t::handle_t _mailbox_handle;
57 
58  // I/O multiplexing is performed using a poller object.
59  poller_t *_poller;
60 
61  ZMQ_NON_COPYABLE_NOR_MOVABLE (io_thread_t)
62 };
63 }
64 
65 #endif
i_poll_events.hpp
zmq::ZMQ_FINAL::_poller
poller_t * _poller
Definition: io_thread.hpp:59
zmq
Definition: zmq.hpp:229
zmq::ZMQ_FINAL::_mailbox
mailbox_t _mailbox
Definition: io_thread.hpp:53
stdint.hpp
poller.hpp
start
GLuint start
Definition: glcorearb.h:2858
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
mailbox.hpp
object.hpp
ZMQ_FINAL
Definition: unittest_ip_resolver.cpp:26
zmq::ZMQ_FINAL::_mailbox_handle
poller_t::handle_t _mailbox_handle
Definition: io_thread.hpp:56


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54