/src/libzmq/src/io_object.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: MPL-2.0 */ |
2 | | |
3 | | #include "precompiled.hpp" |
4 | | #include "io_object.hpp" |
5 | | #include "io_thread.hpp" |
6 | | #include "err.hpp" |
7 | | |
8 | | zmq::io_object_t::io_object_t (io_thread_t *io_thread_) : _poller (NULL) |
9 | 1.09k | { |
10 | 1.09k | if (io_thread_) |
11 | 1.09k | plug (io_thread_); |
12 | 1.09k | } |
13 | | |
14 | | zmq::io_object_t::~io_object_t () |
15 | 1.09k | { |
16 | 1.09k | } |
17 | | |
18 | | void zmq::io_object_t::plug (io_thread_t *io_thread_) |
19 | 1.09k | { |
20 | 1.09k | zmq_assert (io_thread_); |
21 | 1.09k | zmq_assert (!_poller); |
22 | | |
23 | | // Retrieve the poller from the thread we are running in. |
24 | 1.09k | _poller = io_thread_->get_poller (); |
25 | 1.09k | } |
26 | | |
27 | | void zmq::io_object_t::unplug () |
28 | 0 | { |
29 | 0 | zmq_assert (_poller); |
30 | | |
31 | | // Forget about old poller in preparation to be migrated |
32 | | // to a different I/O thread. |
33 | 0 | _poller = NULL; |
34 | 0 | } |
35 | | |
36 | | zmq::io_object_t::handle_t zmq::io_object_t::add_fd (fd_t fd_) |
37 | 131 | { |
38 | 131 | return _poller->add_fd (fd_, this); |
39 | 131 | } |
40 | | |
41 | | void zmq::io_object_t::rm_fd (handle_t handle_) |
42 | 131 | { |
43 | 131 | _poller->rm_fd (handle_); |
44 | 131 | } |
45 | | |
46 | | void zmq::io_object_t::set_pollin (handle_t handle_) |
47 | 131 | { |
48 | 131 | _poller->set_pollin (handle_); |
49 | 131 | } |
50 | | |
51 | | void zmq::io_object_t::reset_pollin (handle_t handle_) |
52 | 0 | { |
53 | 0 | _poller->reset_pollin (handle_); |
54 | 0 | } |
55 | | |
56 | | void zmq::io_object_t::set_pollout (handle_t handle_) |
57 | 0 | { |
58 | 0 | _poller->set_pollout (handle_); |
59 | 0 | } |
60 | | |
61 | | void zmq::io_object_t::reset_pollout (handle_t handle_) |
62 | 0 | { |
63 | 0 | _poller->reset_pollout (handle_); |
64 | 0 | } |
65 | | |
66 | | void zmq::io_object_t::add_timer (int timeout_, int id_) |
67 | 0 | { |
68 | 0 | _poller->add_timer (timeout_, this, id_); |
69 | 0 | } |
70 | | |
71 | | void zmq::io_object_t::cancel_timer (int id_) |
72 | 0 | { |
73 | 0 | _poller->cancel_timer (this, id_); |
74 | 0 | } |
75 | | |
76 | | void zmq::io_object_t::in_event () |
77 | 0 | { |
78 | 0 | zmq_assert (false); |
79 | 0 | } |
80 | | |
81 | | void zmq::io_object_t::out_event () |
82 | 0 | { |
83 | 0 | zmq_assert (false); |
84 | 0 | } |
85 | | |
86 | | void zmq::io_object_t::timer_event (int) |
87 | 0 | { |
88 | 0 | zmq_assert (false); |
89 | 0 | } |