From 84fc2c3cd62ab5be51d65f818854bb031b74c0f2 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Fri, 2 Sep 2022 16:19:07 +0200 Subject: [libc++] Make the naming of private member variables consistent and enforce it through readability-identifier-naming Reviewed By: ldionne, #libc Spies: aheejin, sstefan1, libcxx-commits Differential Revision: https://reviews.llvm.org/D129386 --- libcxx/include/semaphore | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'libcxx/include/semaphore') diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore index 228cf77..3e4f51c 100644 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -80,31 +80,31 @@ functions. It avoids contention against users' own use of those facilities. class __atomic_semaphore_base { - __atomic_base __a; + __atomic_base __a_; public: _LIBCPP_INLINE_VISIBILITY - constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a(__count) + constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) { } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void release(ptrdiff_t __update = 1) { - if(0 < __a.fetch_add(__update, memory_order_release)) + if(0 < __a_.fetch_add(__update, memory_order_release)) ; else if(__update > 1) - __a.notify_all(); + __a_.notify_all(); else - __a.notify_one(); + __a_.notify_one(); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void acquire() { auto const __test_fn = [this]() -> bool { - auto __old = __a.load(memory_order_relaxed); - return (__old != 0) && __a.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed); + auto __old = __a_.load(memory_order_relaxed); + return (__old != 0) && __a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed); }; - __cxx_atomic_wait(&__a.__a_, __test_fn); + __cxx_atomic_wait(&__a_.__a_, __test_fn); } template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY @@ -118,11 +118,11 @@ public: _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY bool try_acquire() { - auto __old = __a.load(memory_order_acquire); + auto __old = __a_.load(memory_order_acquire); while (true) { if (__old == 0) return false; - if (__a.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) + if (__a_.compare_exchange_strong(__old, __old - 1, memory_order_acquire, memory_order_relaxed)) return true; } } @@ -133,7 +133,7 @@ public: template class counting_semaphore { - __atomic_semaphore_base __semaphore; + __atomic_semaphore_base __semaphore_; public: static constexpr ptrdiff_t max() noexcept { @@ -141,7 +141,7 @@ public: } _LIBCPP_INLINE_VISIBILITY - constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore(__count) { } + constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) { } ~counting_semaphore() = default; counting_semaphore(const counting_semaphore&) = delete; @@ -150,23 +150,23 @@ public: _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void release(ptrdiff_t __update = 1) { - __semaphore.release(__update); + __semaphore_.release(__update); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void acquire() { - __semaphore.acquire(); + __semaphore_.acquire(); } template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY bool try_acquire_for(chrono::duration const& __rel_time) { - return __semaphore.try_acquire_for(chrono::duration_cast(__rel_time)); + return __semaphore_.try_acquire_for(chrono::duration_cast(__rel_time)); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY bool try_acquire() { - return __semaphore.try_acquire(); + return __semaphore_.try_acquire(); } template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -- cgit v1.1