diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-12-07 15:11:15 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-12-09 22:58:19 +0000 |
commit | 9e18a25331fa25c3907249fede65a02c6817b06e (patch) | |
tree | 5ed6fb40f31062cac2fa9424215e7e2c3a3fccb1 /libstdc++-v3/doc/html | |
parent | db5fa0837e464b595a3d63766060bae1c9ac5ccc (diff) | |
download | gcc-9e18a25331fa25c3907249fede65a02c6817b06e.zip gcc-9e18a25331fa25c3907249fede65a02c6817b06e.tar.gz gcc-9e18a25331fa25c3907249fede65a02c6817b06e.tar.bz2 |
libstdc++: Allow std::condition_variable waits to be cancelled [PR103382]
std::condition_variable::wait(unique_lock<mutex>&) is incorrectly marked
noexcept, which means that the __forced_unwind exception used by NPTL
cancellation will terminate the process. It should allow exceptions to
pass through, so that a thread can be cleanly cancelled when waiting on
a condition variable.
The new behaviour is exported as a new version of the symbol, to avoid
an ABI break for existing code linked to the non-throwing definition of
the function. Code linked against older releases will have a reference
to the @GLIBCXX_3.4.11 version, andcode compiled against the new
libstdc++ will get a reference to the @@GLIBCXX_3.4.30 version.
libstdc++-v3/ChangeLog:
PR libstdc++/103382
* config/abi/pre/gnu.ver (GLIBCXX_3.4.11): Do not export old
symbol if .symver renaming is supported.
(GLIBCXX_3.4.30): Export new symbol if .symver renaming is
supported.
* doc/xml/manual/evolution.xml: Document change.
* doc/html/manual/api.html: Regenerate.
* include/bits/std_mutex.h (__condvar::wait, __condvar::wait_until):
Remove noexcept.
* include/std/condition_variable (condition_variable::wait):
Likewise.
* src/c++11/condition_variable.cc (condition_variable::wait):
Likewise.
* src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
Define nothrow wrapper around std::condition_variable::wait and
export the old symbol as an alias to it.
* testsuite/30_threads/condition_variable/members/103382.cc: New test.
Diffstat (limited to 'libstdc++-v3/doc/html')
-rw-r--r-- | libstdc++-v3/doc/html/manual/api.html | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html index 00701fa..1c7fdaa 100644 --- a/libstdc++-v3/doc/html/manual/api.html +++ b/libstdc++-v3/doc/html/manual/api.html @@ -450,4 +450,9 @@ options for <code class="option">--enable-libstdcxx-allocator</code> were remove For the <code class="literal">new</code> option, <code class="classname">std::allocator</code> no longer derives from <code class="classname">__gnu_cxx::new_allocator</code>; they both derive from <code class="classname">std::__new_allocator</code> instead. +</p><p> +<code class="function">std::condition_variable::wait</code> changed to be +<code class="code">noexcept(false)</code> to allow thread cancellation exceptions to +be thrown from <code class="function">pthread_cond_wait</code> without aborting +the process. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="abi.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="backwards.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ABI Policy and Guidelines </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Backwards Compatibility</td></tr></table></div></body></html>
\ No newline at end of file |