[libcxx-commits] [libcxx] [libc++] atomic_wait refator experiment (PR #85086)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 13 07:36:28 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7dc4d5f6a0012d6a2485640f6c3c9ca388a02433 bb79cd6fe7ea87af255d4e64020e04d2ec1fb1e2 -- libcxx/include/__atomic/atomic_base.h libcxx/include/__atomic/atomic_flag.h libcxx/include/__atomic/atomic_sync.h libcxx/src/atomic.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index b7bf5c9102..78651cf414 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -75,14 +75,15 @@ struct __atomic_waitable_contention_self {
   volatile __cxx_atomic_contention_t* __waiter_count_;
   const volatile __cxx_atomic_contention_t* __platform_state_;
 
-  _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __atomic_waitable_contention_self(const volatile __cxx_atomic_contention_t*);
+  _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI
+  __atomic_waitable_contention_self(const volatile __cxx_atomic_contention_t*);
   _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __monitor();
   _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __wait(__cxx_contention_t __old_value);
   _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __notify_one();
   _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __notify_all();
 };
 
-struct __atomic_waitable_contention_global  {
+struct __atomic_waitable_contention_global {
   volatile __cxx_atomic_contention_t* __waiter_count_;
   volatile __cxx_atomic_contention_t* __platform_state_;
 
@@ -106,7 +107,7 @@ struct __atomic_wait_backoff_impl {
     if (__elapsed > chrono::microseconds(64)) {
       auto __contention_address = __waitable_traits::__atomic_contention_address(__a_);
       __cxx_contention_t __monitor_val = __contention_address.__monitor();
-      auto __current_val = __waitable_traits::__atomic_load(__a_, __order_);
+      auto __current_val               = __waitable_traits::__atomic_load(__a_, __order_);
       if (__poll_(__current_val))
         return true;
       __contention_address.__wait(__monitor_val);

``````````

</details>


https://github.com/llvm/llvm-project/pull/85086


More information about the libcxx-commits mailing list