mirror of git://gcc.gnu.org/git/gcc.git
Make the shared_mutex::try_lock(), shared_timed_mutex::try_lock_until() and shared_timed_mutex::try_lock_shared_until() all handle errors from pthread functions consistently by returning false to indicate that the lock could not be taken. If _GLIBCXX_ASSERTIONS is defined then unexpected errors, such as EDEADLK and EINVAL will cause an assertion failure. If _GLIBCXX_ASSERTIONS is not defined then these functions no longer ever return true incorrectly indicating that they have taken the lock. This removes the previous behaviour of looping on EDEADLK in try_lock_shared_until() and no longer returns true on EINVAL in all of these functions. (In theory at least it should not be possible to trigger EINVAL since 5dba17a3e709859968f939354e6e5e8d796012d3.) Unfortunately my reading of POSIX is that pthread_rwlock_clockrdlock[1], pthread_rwlock_timedrdlock pthread_rwlock_clockwrlock[2] and pthread_rwlock_timedwrlock are allowed to deadlock rather than return EDEADLK when trying to take a lock a second time from the same thread. This means that the deadlock tests cannot be enabled by default. I believe that the tests do work with glibc (2.31 & 2.36) and with the __shared_mutex_cv implementation though. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_rwlock_clockrdlock.html [2] https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_rwlock_clockwrlock.html libstdc++-v3/ChangeLog: * include/std/shared_mutex (try_lock, try_lock_until) (try_lock_shared_until): Respond consistently to errors and deadlocks. * testsuite/30_threads/shared_timed_mutex/try_lock_until/116586.cc: Test deadlock behaviour if possible. Signed-off-by: Mike Crowe <mac@mcrowe.com> |
||
|---|---|---|
| .forgejo | ||
| .github | ||
| INSTALL | ||
| c++tools | ||
| config | ||
| contrib | ||
| fixincludes | ||
| gcc | ||
| gnattools | ||
| gotools | ||
| include | ||
| libada | ||
| libatomic | ||
| libbacktrace | ||
| libcc1 | ||
| libcody | ||
| libcpp | ||
| libdecnumber | ||
| libffi | ||
| libgcc | ||
| libgcobol | ||
| libgfortran | ||
| libgm2 | ||
| libgo | ||
| libgomp | ||
| libgrust | ||
| libiberty | ||
| libitm | ||
| libobjc | ||
| libphobos | ||
| libquadmath | ||
| libsanitizer | ||
| libssp | ||
| libstdc++-v3 | ||
| libvtv | ||
| lto-plugin | ||
| maintainer-scripts | ||
| zlib | ||
| .b4-config | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| ABOUT-NLS | ||
| COPYING | ||
| COPYING.LIB | ||
| COPYING.RUNTIME | ||
| COPYING3 | ||
| COPYING3.LIB | ||
| ChangeLog | ||
| ChangeLog.jit | ||
| ChangeLog.tree-ssa | ||
| MAINTAINERS | ||
| Makefile.def | ||
| Makefile.in | ||
| Makefile.tpl | ||
| README | ||
| SECURITY.txt | ||
| ar-lib | ||
| compile | ||
| config-ml.in | ||
| config.guess | ||
| config.rpath | ||
| config.sub | ||
| configure | ||
| configure.ac | ||
| depcomp | ||
| install-sh | ||
| libtool-ldflags | ||
| libtool.m4 | ||
| ltgcc.m4 | ||
| ltmain.sh | ||
| ltoptions.m4 | ||
| ltsugar.m4 | ||
| ltversion.m4 | ||
| lt~obsolete.m4 | ||
| missing | ||
| mkdep | ||
| mkinstalldirs | ||
| move-if-change | ||
| multilib.am | ||
| symlink-tree | ||
| test-driver | ||
| ylwrap | ||
README
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.