[libcxx-commits] [PATCH] D114109: [libc++] Enable <atomic> when threads are disabled
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 17 10:37:29 PST 2021
ldionne created this revision.
Herald added subscribers: arichardson, mgorny.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
std::atomic is, for the most part, just a thin veneer on top of compiler
builtins. Hence, it should be available even when threads are not available
on the system, and in fact there has been requests for such support.
This patch:
- Moves __libcpp_thread_poll_with_backoff to its own header so it can be used in <atomic> when threads are disabled.
- Adds a dummy backoff policy for atomic polling that doesn't know about threads.
- Adjusts the <atomic> feature-test macros so they are provided even when threads are disabled.
- Runs the <atomic> tests when threads are disabled.
rdar://77873569
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114109
Files:
libcxx/include/CMakeLists.txt
libcxx/include/__config
libcxx/include/__thread/poll_with_backoff.h
libcxx/include/__threading_support
libcxx/include/atomic
libcxx/include/thread
libcxx/include/version
libcxx/src/memory.cpp
libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp
libcxx/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
libcxx/test/libcxx/atomics/atomics.order/memory_order.underlying_type.pass.cpp
libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp
libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp
libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp
libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp
libcxx/test/libcxx/atomics/diagnose_invalid_memory_order.verify.cpp
libcxx/test/libcxx/atomics/ext-int.verify.cpp
libcxx/test/libcxx/atomics/libcpp-has-no-threads.compile.fail.cpp
libcxx/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
libcxx/test/libcxx/atomics/version.pass.cpp
libcxx/test/libcxx/diagnostics/detail.headers/thread/poll_with_backoff.module.verify.cpp
libcxx/test/std/atomics/atomics.fences/atomic_signal_fence.pass.cpp
libcxx/test/std/atomics/atomics.fences/atomic_thread_fence.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_test.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
libcxx/test/std/atomics/atomics.flag/atomic_flag_test_explicit.pass.cpp
libcxx/test/std/atomics/atomics.flag/clear.pass.cpp
libcxx/test/std/atomics/atomics.flag/default.pass.cpp
libcxx/test/std/atomics/atomics.flag/init.pass.cpp
libcxx/test/std/atomics/atomics.flag/test_and_set.pass.cpp
libcxx/test/std/atomics/atomics.general/replace_failure_order.pass.cpp
libcxx/test/std/atomics/atomics.general/replace_failure_order_codegen.sh.cpp
libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
libcxx/test/std/atomics/atomics.lockfree/lockfree.pass.cpp
libcxx/test/std/atomics/atomics.order/kill_dependency.pass.cpp
libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp
libcxx/test/std/atomics/atomics.order/memory_order_new.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/bool.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/copy_semantics_traits.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/standard_layout.compile.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/throw.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp
libcxx/test/std/atomics/atomics.types.generic/trivially_copyable.verify.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/copy.assign.ptr.volatile.verify.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/copy.assign.volatile.verify.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/dtor.pass.cpp
libcxx/test/std/atomics/types.pass.cpp
libcxx/test/std/depr/depr.atomics/depr.atomics.nonmembers/atomic_init.depr_in_cxx20.verify.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114109.387987.patch
Type: text/x-patch
Size: 85189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211117/9d6d3de9/attachment-0001.bin>
More information about the libcxx-commits
mailing list