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
This commit is contained in:
Eric Fiselier
2017-05-05 21:31:22 +00:00
parent 4726a9c727
commit 08fd3361bd

View File

@@ -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;
}