From b7ac94be439124763d2c447b652e6b54a7be5a33 Mon Sep 17 00:00:00 2001 From: Jackie Kay Date: Thu, 14 Apr 2016 13:18:22 -0700 Subject: [PATCH] handle negative timeout (#43) --- rcl/src/rcl/wait.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rcl/src/rcl/wait.c b/rcl/src/rcl/wait.c index 2a1112d..157c86c 100644 --- a/rcl/src/rcl/wait.c +++ b/rcl/src/rcl/wait.c @@ -521,12 +521,10 @@ rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout) temporary_timeout_storage.sec = 0; temporary_timeout_storage.nsec = 0; timeout_argument = &temporary_timeout_storage; - } else { + } else if (timeout > 0) { int64_t min_timeout = INT64_MAX; - if (timeout > 0) { - // Compare the timeout to the time until next callback for each timer. - min_timeout = timeout; - } + // Compare the timeout to the time until next callback for each timer. + min_timeout = timeout; // Take the lowest and use that for the wait timeout. uint64_t i = 0; for (i = 0; i < wait_set->size_of_timers; ++i) {