mirror of https://github.com/facebook/rocksdb.git
Fix CondVar::TimedWait for Windows (#12815)
Summary: Based on https://github.com/microsoft/STL/issues/369 They fixed the issue in `std::condition_variable_any` but not in `std::condition_variable`, which is currently used in rocksdb repo. So we need to implement the work around regardless of `_MSVC_STL_UPDATE`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12815 Reviewed By: cbi42 Differential Revision: D59493690 Pulled By: ajkr fbshipit-source-id: ad0fc9ef9f2357347d21e271c2f1d0a3a97d89be
This commit is contained in:
parent
a97a1f3247
commit
62b62cf135
|
@ -101,8 +101,9 @@ bool CondVar::TimedWait(uint64_t abs_time_us) {
|
|||
std::unique_lock<std::mutex> lk(mu_->getLock(), std::adopt_lock);
|
||||
|
||||
// Work around https://github.com/microsoft/STL/issues/369
|
||||
#if defined(_MSC_VER) && \
|
||||
(!defined(_MSVC_STL_UPDATE) || _MSVC_STL_UPDATE < 202008L)
|
||||
// std::condition_variable_any::wait_for had a fix, but
|
||||
// std::condition_variable still doesn't have a fix in STL yet
|
||||
#if defined(_MSC_VER)
|
||||
if (relTimeUs == std::chrono::microseconds::zero()) {
|
||||
lk.unlock();
|
||||
lk.lock();
|
||||
|
|
Loading…
Reference in New Issue