![]() The std::try_lock and std::lock algorithms can use iteration instead of recursion when all lockables have the same type and can be held by an array of unique_lock<L> objects. By making this change to __detail::__try_lock_impl it also benefits __detail::__lock_impl, which uses it. For std::lock we can just put the iterative version directly in std::lock, to avoid making any call to __detail::__lock_impl. Signed-off-by: Matthias Kretz <m.kretz@gsi.de> Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Co-authored-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: * include/std/mutex (lock): Replace recursion with iteration when lockables all have the same type. (__detail::__try_lock_impl): Likewise. Pass lockables as parameters, instead of a tuple. Always lock the first one, and recurse for the rest. (__detail::__lock_impl): Adjust call to __try_lock_impl. (__detail::__try_to_lock): Remove. * testsuite/30_threads/lock/3.cc: Check that mutexes are locked. * testsuite/30_threads/lock/4.cc: Also test non-heterogeneous arguments. * testsuite/30_threads/unique_lock/cons/60497.cc: Also check std::try_lock. * testsuite/30_threads/try_lock/5.cc: New test. |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
acinclude.m4 | ||
aclocal.m4 | ||
ChangeLog | ||
ChangeLog-1998 | ||
ChangeLog-1999 | ||
ChangeLog-2000 | ||
ChangeLog-2001 | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
ChangeLog-2017 | ||
ChangeLog-2018 | ||
ChangeLog-2019 | ||
ChangeLog-2020 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 | ||
Makefile.am | ||
Makefile.in | ||
README |
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.