From: Samuel Just Date: Wed, 18 May 2016 18:49:19 +0000 (-0700) Subject: BackoffThrottle: use wait_for instead of wait_until X-Git-Tag: v10.2.2~15^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5ce43eb7682535deeee149600f1226b87e41defd;p=ceph.git BackoffThrottle: use wait_for instead of wait_until On some platforms, wait_until won't surrender the lock with a negative argument. Signed-off-by: Samuel Just (cherry picked from commit 846808ff3f3837b1772f293ae71dba5eda609cc4) --- diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 3b909ee4112..14cf1ba894d 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -376,11 +376,11 @@ std::chrono::duration BackoffThrottle::get(uint64_t c) auto start = std::chrono::system_clock::now(); delay = _get_delay(c); - while (((start + delay) > std::chrono::system_clock::now()) || + while ((delay > std::chrono::duration(0)) || !((max == 0) || (current == 0) || ((current + c) <= max))) { assert(ticket == waiters.begin()); - (*ticket)->wait_until(l, start + delay); - delay = _get_delay(c); + (*ticket)->wait_for(l, delay); + delay = _get_delay(c) - (std::chrono::system_clock::now() - start); } waiters.pop_front(); _kick_waiters();