From 08fd3361bd23246d89f7007badee0fef65f025d7 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 5 May 2017 21:31:22 +0000 Subject: [PATCH] Fix condition_variable::wait_until and wait_for on Windows. The ERROR_TIMEDOUT returned by the Windows API does not have the same value as ETIMEDOUT. This caused condition_variable to return timeouts as unknown errors. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302297 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__threading_support | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/__threading_support b/include/__threading_support index aa947139a..080ebd256 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -474,7 +474,10 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, timeout_ms.count() > 0 ? timeout_ms.count() : 0, 0)) - return GetLastError(); + { + auto __ec = GetLastError(); + return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec; + } return 0; }