From 35c6985e68378bb3a71e150e6368973556675e2a Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 18 Nov 2018 12:32:51 +0000 Subject: [PATCH] Problem: zmq_stopwatch_intermediate is eligible for STABLE Solution: do it --- NEWS | 2 ++ include/zmq.h | 2 -- src/zmq_draft.h | 4 ---- tests/test_timers.cpp | 6 ------ 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 72a7e07c..d9311cc4 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ - ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: Protocol errors with peers or ZAP. - ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: Failed authentication requests. See doc/zmq_socket_monitor.txt for more details and error codes. + - zmq_stopwatch_intermediate which returns the time elapsed without stopping + the stopwatch. * The build-time configuration option to select the poller has been split, and new API_POLLER (CMake) and --with-api-poller (autoconf) options will now diff --git a/include/zmq.h b/include/zmq.h index 55973f34..55a68cf4 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -610,11 +610,9 @@ ZMQ_EXPORT int zmq_timers_execute (void *timers); /* Starts the stopwatch. Returns the handle to the watch. */ ZMQ_EXPORT void *zmq_stopwatch_start (void); -#ifdef ZMQ_BUILD_DRAFT_API /* Returns the number of microseconds elapsed since the stopwatch was */ /* started, but does not stop or deallocate the stopwatch. */ ZMQ_EXPORT unsigned long zmq_stopwatch_intermediate (void *watch_); -#endif /* Stops the stopwatch. Returns the number of microseconds elapsed since */ /* the stopwatch was started, and deallocates that watch. */ diff --git a/src/zmq_draft.h b/src/zmq_draft.h index 5fc57613..be1165aa 100644 --- a/src/zmq_draft.h +++ b/src/zmq_draft.h @@ -37,10 +37,6 @@ #ifndef ZMQ_BUILD_DRAFT_API -/* Returns the number of microseconds elapsed since the stopwatch was */ -/* started, but does not stop or deallocate the stopwatch. */ -unsigned long zmq_stopwatch_intermediate (void *watch_); - /* DRAFT Socket types. */ #define ZMQ_SERVER 12 #define ZMQ_CLIENT 13 diff --git a/tests/test_timers.cpp b/tests/test_timers.cpp index 43e17b45..3e2b39c9 100644 --- a/tests/test_timers.cpp +++ b/tests/test_timers.cpp @@ -156,21 +156,17 @@ void test_timers () // Timer should not have been invoked yet TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_execute (timers)); -#ifdef ZMQ_BUILD_DRAFT_API if (zmq_stopwatch_intermediate (stopwatch) < full_timeout) { TEST_ASSERT_FALSE (timer_invoked); } -#endif // Wait half the time and check again long timeout = TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_timeout (timers)); msleep (timeout / 2); TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_execute (timers)); -#ifdef ZMQ_BUILD_DRAFT_API if (zmq_stopwatch_intermediate (stopwatch) < full_timeout) { TEST_ASSERT_FALSE (timer_invoked); } -#endif // Wait until the end TEST_ASSERT_SUCCESS_ERRNO (sleep_and_execute (timers)); @@ -181,11 +177,9 @@ void test_timers () timeout = TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_timeout (timers)); msleep (timeout / 2); TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_execute (timers)); -#ifdef ZMQ_BUILD_DRAFT_API if (zmq_stopwatch_intermediate (stopwatch) < 2 * full_timeout) { TEST_ASSERT_FALSE (timer_invoked); } -#endif // Reset timer and wait half of the time left TEST_ASSERT_SUCCESS_ERRNO (zmq_timers_reset (timers, timer_id));