@@ -588,16 +588,21 @@ public:
588
588
#if _HAS_CXX20
589
589
static_assert(chrono::is_clock_v<_Clock>, "Clock type required");
590
590
#endif // _HAS_CXX20
591
+ if (!_Mtx_current_owns(_Lck.mutex()->_Mymtx())) {
592
+ _Throw_Cpp_error(_OPERATION_NOT_PERMITTED);
593
+ }
591
594
for (;;) {
592
595
const auto _Now = _Clock::now();
593
596
if (_Abs_time <= _Now) {
594
597
return cv_status::timeout;
595
598
}
596
599
600
+ // TRANSITION, ABI: incorrectly relying on system_clock
597
601
_timespec64 _Tgt;
598
602
(void) _To_timespec64_sys_10_day_clamped(_Tgt, _Abs_time - _Now);
599
- const cv_status _Result = _Wait_until_sys_time(_Lck, &_Tgt);
600
- if (_Result == cv_status::no_timeout) {
603
+ // Nothing to do to comply with LWG-2135 because std::mutex lock/unlock are nothrow
604
+ const _Thrd_result _Res = _Cnd_timedwait(_Mycnd(), _Lck.mutex()->_Mymtx(), _Abs_time);
605
+ if (_Res == _Thrd_result::_Success) {
601
606
return cv_status::no_timeout;
602
607
}
603
608
}
@@ -635,22 +640,6 @@ private:
635
640
_Cnd_t _Mycnd() noexcept { // get pointer to _Cnd_internal_imp_t inside _Cnd_storage
636
641
return reinterpret_cast<_Cnd_t>(&_Cnd_storage);
637
642
}
638
-
639
- cv_status _Wait_until_sys_time(unique_lock<mutex>& _Lck, const _timespec64* _Abs_time) {
640
- // wait for signal with timeout
641
- if (!_Mtx_current_owns(_Lck.mutex()->_Mymtx())) {
642
- _Throw_Cpp_error(_OPERATION_NOT_PERMITTED);
643
- }
644
-
645
- // Nothing to do to comply with LWG-2135 because std::mutex lock/unlock are nothrow
646
- const _Thrd_result _Res = _Cnd_timedwait(_Mycnd(), _Lck.mutex()->_Mymtx(), _Abs_time);
647
-
648
- if (_Res == _Thrd_result::_Success) {
649
- return cv_status::no_timeout;
650
- } else {
651
- return cv_status::timeout;
652
- }
653
- }
654
643
};
655
644
656
645
struct _UInt_is_zero {
0 commit comments