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 @@ -2654,6 +2654,15 @@ template<typename T = no_user_data> class poller_t
2654
2654
throw error_t ();
2655
2655
}
2656
2656
2657
+ #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 3)
2658
+ size_t size () const noexcept
2659
+ {
2660
+ int rc = zmq_poller_size (const_cast <void *>(poller_ptr.get ()));
2661
+ ZMQ_ASSERT (rc >= 0 );
2662
+ return static_cast <size_t >(std::max (rc, 0 ));
2663
+ }
2664
+ #endif
2665
+
2657
2666
private:
2658
2667
struct destroy_poller_t
2659
2668
{
You can’t perform that action at this time.
0 commit comments