Skip to content

Commit

Permalink
mt: Make condition_variable::native_handle() conditional.
Browse files Browse the repository at this point in the history
* According to the C++ standard, the presence and semantics of
  std::condition_variable::native_handle (and native_handle_type) is
  implementation-defined. E.g., starting with VS 2022 17.8, Microsoft's
  implementation no longer provides them at all.
  • Loading branch information
Benjamin Kaufmann committed Nov 22, 2023
1 parent 686973b commit c84b07d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clasp/mt/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ struct condition_variable : private std::condition_variable {
using base_type::notify_one;
using base_type::notify_all;
using base_type::wait;
using base_type::native_handle;

template <typename X = std::condition_variable>
inline auto native_handle() -> typename X::native_handle_type {
return X::native_handle();
}

inline bool wait_for(unique_lock<mutex>& lock, double timeInSecs) {
return base_type::wait_for(lock, std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(timeInSecs)))
Expand Down

0 comments on commit c84b07d

Please sign in to comment.