summaryrefslogtreecommitdiff
path: root/libcxx/src/barrier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src/barrier.cpp')
-rw-r--r--libcxx/src/barrier.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libcxx/src/barrier.cpp b/libcxx/src/barrier.cpp
index baa26101cd57..69601bfeec05 100644
--- a/libcxx/src/barrier.cpp
+++ b/libcxx/src/barrier.cpp
@@ -21,17 +21,17 @@ public:
} __tickets[64];
};
- ptrdiff_t& __expected;
- unique_ptr<__state_t[]> __state;
+ ptrdiff_t& __expected_;
+ unique_ptr<__state_t[]> __state_;
- _LIBCPP_HIDDEN __barrier_algorithm_base(ptrdiff_t& __expected) : __expected(__expected) {
+ _LIBCPP_HIDDEN __barrier_algorithm_base(ptrdiff_t& __expected) : __expected_(__expected) {
size_t const __count = (__expected + 1) >> 1;
- __state = unique_ptr<__state_t[]>(new __state_t[__count]);
+ __state_ = unique_ptr<__state_t[]>(new __state_t[__count]);
}
_LIBCPP_HIDDEN bool __arrive(__barrier_phase_t __old_phase) {
__barrier_phase_t const __half_step = __old_phase + 1, __full_step = __old_phase + 2;
- size_t __current_expected = __expected,
- __current = hash<thread::id>()(this_thread::get_id()) % ((__expected + 1) >> 1);
+ size_t __current_expected = __expected_,
+ __current = hash<thread::id>()(this_thread::get_id()) % ((__expected_ + 1) >> 1);
for (int __round = 0;; ++__round) {
if (__current_expected <= 1)
return true;
@@ -41,14 +41,14 @@ public:
__current = 0;
__barrier_phase_t expect = __old_phase;
if (__current == __last_node && (__current_expected & 1)) {
- if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __full_step, memory_order_acq_rel))
break; // I'm 1 in 1, go to next __round
- } else if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ } else if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __half_step, memory_order_acq_rel)) {
return false; // I'm 1 in 2, done with arrival
} else if (expect == __half_step) {
- if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __full_step, memory_order_acq_rel))
break; // I'm 2 in 2, go to next __round
}
@@ -63,10 +63,10 @@ _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorith
return new __barrier_algorithm_base(__expected);
}
_LIBCPP_EXPORTED_FROM_ABI bool
-__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) {
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
return __barrier->__arrive(__old_phase);
}
-_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) {
+_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept {
delete __barrier;
}