aboutsummaryrefslogtreecommitdiff
path: root/contrib/git-commit-mklog.py
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-06-22 13:35:19 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-06-22 21:17:25 +0100
commitc556596119307f9ef1c9079ef2bd3a035dea355d (patch)
tree0292d6d165df8828a851fe18b32cf4f2698dc3c0 /contrib/git-commit-mklog.py
parentb5a29741db11007e37d8d4ff977b89a8314abfda (diff)
downloadgcc-c556596119307f9ef1c9079ef2bd3a035dea355d.zip
gcc-c556596119307f9ef1c9079ef2bd3a035dea355d.tar.gz
gcc-c556596119307f9ef1c9079ef2bd3a035dea355d.tar.bz2
libstdc++: Simplify std::try_lock and std::lock further
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.
Diffstat (limited to 'contrib/git-commit-mklog.py')
0 files changed, 0 insertions, 0 deletions