[libcxx-commits] [PATCH] D68480: Implementation of C++20's P1135R6 for libcxx

Olivier Giroux via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 25 10:35:11 PST 2020


__simt__ updated this revision to Diff 240389.
__simt__ marked 11 inline comments as done.
__simt__ added a comment.

A lot of changes in this patch, mostly simplifications based on the areas that got feedback about complexity.

For the most part, I have deleted code:

1. I deleted the condvar-based implementation of atomic_wait because no current platform would make use of it. That also allowed me to delete much of the complicated ABI tricks added in the last revision. That removed several configuration macros.
2. After discussing it with Louis, I switched the Apple config to use atomics-based semaphores. Not only did that delete a lot of code on its own, but it made some other optimizations in semaphores no longer needed, so I deleted them too. That removed several more configuration macros as well.
3. I deleted code dealing with the thread_local optimization in barrier. Using this_thread::get::id to inject a thread-stable search seed for the algorithm is about just as good, and everything for that already exists.
4. Latches, barriers and semaphores make more direct use of the wait/notify functionality now. Where they had "exceptions" with customized waiting, now there's a unified interface there, which deletes code.

In addition to this, the internal abstractions are much better now. I particularly like how natively-supported Futex types pass-through the intermediate layer now, it just works.

I hope you find this version is close enough that we might soon switch to delta patches on top, in trunk.

Cheers,

Olivier


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68480/new/

https://reviews.llvm.org/D68480

Files:
  libcxx/include/CMakeLists.txt
  libcxx/include/__threading_support
  libcxx/include/atomic
  libcxx/include/barrier
  libcxx/include/latch
  libcxx/include/module.modulemap
  libcxx/include/semaphore
  libcxx/src/CMakeLists.txt
  libcxx/src/atomic.cpp
  libcxx/src/barrier.cpp
  libcxx/test/libcxx/double_include.sh.cpp
  libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.wait/atomic_wait.pass.cpp
  libcxx/test/std/atomics/types.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive_and_drop.pass.cpp
  libcxx/test/std/thread/thread.barrier/arrive_and_wait.pass.cpp
  libcxx/test/std/thread/thread.barrier/completion.pass.cpp
  libcxx/test/std/thread/thread.barrier/version.pass.cpp
  libcxx/test/std/thread/thread.latch/arrive_and_wait.pass.cpp
  libcxx/test/std/thread/thread.latch/count_down.pass.cpp
  libcxx/test/std/thread/thread.latch/try_wait.pass.cpp
  libcxx/test/std/thread/thread.latch/version.pass.cpp
  libcxx/test/std/thread/thread.semaphore/acquire.pass.cpp
  libcxx/test/std/thread/thread.semaphore/binary.pass.cpp
  libcxx/test/std/thread/thread.semaphore/max.pass.cpp
  libcxx/test/std/thread/thread.semaphore/release.pass.cpp
  libcxx/test/std/thread/thread.semaphore/timed.pass.cpp
  libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp
  libcxx/test/std/thread/thread.semaphore/version.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68480.240389.patch
Type: text/x-patch
Size: 70134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200125/b6e0c58f/attachment-0001.bin>


More information about the libcxx-commits mailing list