From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8EEE3858436; Wed, 21 Dec 2022 13:22:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8EEE3858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671628944; bh=7fDxQ1cVWCatSxow1s0FUyB4oCd7EZRtvR4qHQjvMkM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hmLkLhjy7DGOt63OgkYw0djPmdBqXG10qc3mN3Cp6X4tuGbHrWQuJ5dvSN4bk+KR+ rOKyKBG7+ySkRft/L3O10zUHoCuN+qhSo5crDhDiE3jpRSugkwdqXO51hsO8laXxSZ vuI38gGyXnrgdDfqX1rYAi/9BxO/GwZMnJjy69o4= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105730] [12/13 Regression] Issue with commit - Allow std::condition_variable waits to be cancelled Date: Wed, 21 Dec 2022 13:22:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: EH X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105730 --- Comment #8 from Jonathan Wakely --- I think this should solve the problem: --- a/libstdc++-v3/src/c++11/compatibility-condvar.cc +++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc @@ -67,6 +67,22 @@ _GLIBCXX_END_NAMESPACE_VERSION && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { +namespace +{ + std::__condvar std::condition_variable::* __base_member; + + template + struct cracker + { + static std::__condvar std::condition_variable::* value; + }; + template + std::__condvar std::condition_variable::* + cracker::value =3D __base_member =3D X; + + template class cracker<&std::condition_variable::_M_cond>; +} + struct __nothrow_wait_cv : std::condition_variable { void wait(std::unique_lock&) noexcept; @@ -76,7 +92,7 @@ __attribute__((used)) void __nothrow_wait_cv::wait(std::unique_lock& lock) noexcept { - this->condition_variable::wait(lock); + (this->*__base_member).wait(*lock.mutex()); } } // namespace __gnu_cxx=