From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ED2013858C39; Wed, 24 Nov 2021 14:46:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED2013858C39 From: "vanyacpp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103382] condition_variable::wait() is not cancellable because it is marked noexcept Date: Wed, 24 Nov 2021 14:46:03 +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: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vanyacpp at gmail dot com 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: --- 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 14:46:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103382 --- Comment #3 from Ivan Sorokin --- > Huh, I thought it was noexcept. Then yes, we should remove it. Thank you very much! I'm looking forward for a fix. > There are still lots of other places where the stadnard does require 'noe= xcept' and cancellation will terminate. Do you have any specific functions in mind? If so perhaps something can be = done about them too. Some people claim that noexcept and cancellation and mutually incompatible,= but I don't think this is the case. I believe that by following a simple discip= line noexcept and cancellation can interact very well. First of all not all noexcept functions are problematic: noexcept functions that don't call cancellation points are perfectly fine. The noexcept functions that do call some cancellation points can be fixed by suppression/restoring of cancellation. For example, a destructor that calls close() which is a cancellation point should just suppress/restore cancellation. Same for a destructor that calls pthread_join(). One might say that because of this we lose some cancellation points and this is true, but= I believe that noexcept are the places where program can not recover preservi= ng exception guarantees and having cancellation suppressed in these places is perfectly fine.=