Commit 5224b870 authored by Simon Giesecke's avatar Simon Giesecke

Problem: race condition in unit test

Solution: fix order of statements in test_events_t
parent 487c2758
...@@ -63,9 +63,11 @@ struct test_events_t : zmq::i_poll_events ...@@ -63,9 +63,11 @@ struct test_events_t : zmq::i_poll_events
virtual void in_event () virtual void in_event ()
{ {
in_events.add (1);
poller.rm_fd (handle); poller.rm_fd (handle);
handle = (zmq::poller_t::handle_t) NULL; handle = (zmq::poller_t::handle_t) NULL;
// this must only be incremented after rm_fd
in_events.add (1);
} }
...@@ -78,9 +80,11 @@ struct test_events_t : zmq::i_poll_events ...@@ -78,9 +80,11 @@ struct test_events_t : zmq::i_poll_events
virtual void timer_event (int id_) virtual void timer_event (int id_)
{ {
LIBZMQ_UNUSED (id_); LIBZMQ_UNUSED (id_);
timer_events.add (1);
poller.rm_fd (handle); poller.rm_fd (handle);
handle = (zmq::poller_t::handle_t) NULL; handle = (zmq::poller_t::handle_t) NULL;
// this must only be incremented after rm_fd
timer_events.add (1);
} }
void set_handle (zmq::poller_t::handle_t handle_) { handle = handle_; } void set_handle (zmq::poller_t::handle_t handle_) { handle = handle_; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment