Re: [committed] libstdc++: Improve std::lock algorithm

2021-06-22 Thread Matthias Kretz
On Monday, 21 June 2021 19:31:59 CEST Jonathan Wakely via Gcc-patches wrote: > diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex > index d4c5d13f654..5f2d8f9ee7b 100644 > --- a/libstdc++-v3/include/std/mutex > +++ b/libstdc++-v3/include/std/mutex > @@ -512,47 +512,44 @@ _

[committed] libstdc++: Improve std::lock algorithm

2021-06-21 Thread Jonathan Wakely via Gcc-patches
The current std::lock algorithm is the one called "persistent" in Howard Hinnant's https://howardhinnant.github.io/dining_philosophers.html post. While it tends to perform acceptably fast, it wastes a lot of CPU cycles by continuously locking and unlocking the uncontended mutexes. Effectively, it's