[committed 2/2] libstdc++: Only include <condition_variable> in <shared_mutex> if needed
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Oct 22 18:06:58 GMT 2020
This chart shows the memory usage (in kB as shown by -ftime-report) for the
compiling a translation unit including each affected header in C++20 mode,
before the changes, and after each of the two patches. <scoped_allocator>
really didn't need all of <memory>!
[image: test.png]
On Thu, 22 Oct 2020 at 19:03, Jonathan Wakely via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:
> The <condition_variable> header is not small, so <shared_mutex> should
> not include it unless it actually needs std::condition_variable, which
> is only the case when we don't have pthread_rwlock_t and the POSIX
> Timers option.
>
> The <shared_mutex> header would be even smaller if we had a header for
> std::condition_variable (separate from std::condition_variable_any).
> That's already planned for a future change.
>
> And <memory_resource> would be even smaller if it was possible to get
> std::shared_mutex without std::shared_timed_mutex (which depends on
> <chrono>). For that to be effective, the synchronized_pool_resource
> would have to create its own simpler version of std::shared_lock without
> the timed waiting functions. I have no plans to do that.
>
> libstdc++-v3/ChangeLog:
>
> * include/std/shared_mutex: Only include <condition_variable>
> when pthread_rwlock_t and POSIX timers are not available.
> (__cpp_lib_shared_mutex, __cpp_lib_shared_timed_mutex): Change
> value to be type 'long'.
> * include/std/version (__cpp_lib_shared_mutex)
> (__cpp_lib_shared_timed_mutex): Likewise.
>
>
> Tested powerpc64le-linux. Committed to trunk.
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 5874 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20201022/eff6c1ec/attachment.png>
More information about the Libstdc++
mailing list