[all-commits] [llvm/llvm-project] bf1666: [libc++] Drop support for the C++20 Synchronizatio...

Louis Dionne via All-commits all-commits at lists.llvm.org
Wed Jul 31 14:53:32 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf1666fb0bc19ffa18072e2727e4611c293a9aee
      https://github.com/llvm/llvm-project/commit/bf1666fb0bc19ffa18072e2727e4611c293a9aee
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-07-31 (Wed, 31 Jul 2024)

  Changed paths:
    M libcxx/.clang-format
    M libcxx/docs/ReleaseNotes/20.rst
    M libcxx/include/__atomic/atomic.h
    M libcxx/include/__atomic/atomic_base.h
    M libcxx/include/__atomic/atomic_flag.h
    M libcxx/include/__config
    M libcxx/include/atomic
    M libcxx/include/barrier
    M libcxx/include/latch
    M libcxx/include/semaphore
    M libcxx/test/std/atomics/atomics.types.generic/general.compile.pass.cpp
    M libcxx/test/std/atomics/atomics.types.generic/pointer.compile.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_all.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_notify_one.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait_explicit.pass.cpp
    M libcxx/test/std/thread/thread.barrier/arrive.pass.cpp
    M libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp
    M libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp
    M libcxx/test/std/thread/thread.barrier/completion.pass.cpp
    M libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp
    M libcxx/test/std/thread/thread.barrier/max.pass.cpp
    M libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp
    M libcxx/test/std/thread/thread.latch/count_down.pass.cpp
    M libcxx/test/std/thread/thread.latch/ctor.pass.cpp
    M libcxx/test/std/thread/thread.latch/max.pass.cpp
    M libcxx/test/std/thread/thread.latch/try_wait.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/binary.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/ctor.compile.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/max.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/release.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/timed.pass.cpp
    M libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp

  Log Message:
  -----------
  [libc++] Drop support for the C++20 Synchronization Library before C++20 (#82008)

When we initially implemented the C++20 synchronization library, we
reluctantly accepted for the implementation to be backported to C++03
upon request from the person who provided the patch. This was when we
were only starting to have experience with the issues this can create,
so we flinched. Nowadays, we have a much stricter stance about not
backporting features to previous standards.

We have recently started fixing several bugs (and near bugs) in our
implementation of the synchronization library. A recurring theme during
these reviews has been how difficult to understand the current code is,
and upon inspection it becomes clear that being able to use a few recent
C++ features (in particular lambdas) would help a great deal. The code
would still be pretty intricate, but it would be a lot easier to reason
about the flow of callbacks through things like
__thread_poll_with_backoff.

As a result, this patch drops support for the synchronization library
before C++20. This makes us more strictly conforming and opens the door
to major simplifications, in particular around atomic_wait which was
supported all the way to C++03.

This change will probably have some impact on downstream users, however
since the C++20 synchronization library was added only in LLVM 10 (~3
years ago) and it's quite a niche feature, the set of people trying to
use this part of the library before C++20 should be reasonably small.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list