File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,20 @@ TEST_CASE("poller wait with no handlers throws", "[poller]")
133
133
const zmq::error_t &);
134
134
}
135
135
136
+ #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3)
137
+ TEST_CASE (" poller add/remove size checks" , " [poller]" )
138
+ {
139
+ zmq::context_t context;
140
+ zmq::socket_t socket{context, zmq::socket_type::router};
141
+ zmq::poller_t <> poller;
142
+ CHECK (poller.size () == 0 );
143
+ poller.add (socket, zmq::event_flags::pollin);
144
+ CHECK (poller.size () == 1 );
145
+ CHECK_NOTHROW (poller.remove (socket));
146
+ CHECK (poller.size () == 0 );
147
+ }
148
+ #endif
149
+
136
150
TEST_CASE (" poller remove unregistered throws" , " [poller]" )
137
151
{
138
152
zmq::context_t context;
Original file line number Diff line number Diff line change @@ -2653,6 +2653,15 @@ template<typename T = no_user_data> class poller_t
2653
2653
throw error_t ();
2654
2654
}
2655
2655
2656
+ #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3)
2657
+ size_t size () const noexcept
2658
+ {
2659
+ int rc = zmq_poller_size (const_cast <void *>(poller_ptr.get ()));
2660
+ ZMQ_ASSERT (rc >= 0 );
2661
+ return static_cast <size_t >(std::max (rc, 0 ));
2662
+ }
2663
+ #endif
2664
+
2656
2665
private:
2657
2666
struct destroy_poller_t
2658
2667
{
You can’t perform that action at this time.
0 commit comments