From f3e767754031663427d66f57266ade5a20333aad Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 9 Jan 2017 22:32:11 +0000 Subject: [PATCH] Swap two lines in __mutex_base. On systems with high clock rates, we could mistakenly return no_timeout when a mutex had timed out if we got a tick between these two lines. Thanks to Brian Cain for the bug report. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291492 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__mutex_base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/__mutex_base b/include/__mutex_base index cce928784..21638ee32 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -410,8 +410,8 @@ condition_variable::wait_for(unique_lock& __lk, typedef time_point > __sys_tpf; typedef time_point __sys_tpi; __sys_tpf _Max = __sys_tpi::max(); - system_clock::time_point __s_now = system_clock::now(); steady_clock::time_point __c_now = steady_clock::now(); + system_clock::time_point __s_now = system_clock::now(); if (_Max - __d > __s_now) __do_timed_wait(__lk, __s_now + __ceil(__d)); else