From b2cb69647e04765b87f0f1ba9f39b4a353574135 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 13 Feb 2012 13:30:31 -0800 Subject: PR libstdc++/51798 continued PR libstdc++/51798 continued * include/bits/shared_ptr_base.h (_Sp_counted_base<_S_atomic>::_M_add_ref_lock): Hoist initial load outside compare_exchange loop. * include/tr1/shared_ptr.h: Same. * include/parallel/compatibility.h (__compare_and_swap_32): Use strong version of compare_exchange. (__compare_and_swap_64): Same. * include/profile/impl/profiler_state.h (__gnu_profile::__turn): Same. * libsupc++/guard.cc (__cxa_guard_acquire): Same. From-SVN: r184171 --- libstdc++-v3/libsupc++/guard.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3/libsupc++') diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc index b7b8d3f..adc9608 100644 --- a/libstdc++-v3/libsupc++/guard.cc +++ b/libstdc++-v3/libsupc++/guard.cc @@ -251,8 +251,9 @@ namespace __cxxabiv1 while (1) { - if (__atomic_compare_exchange_n(gi, &expected, pending_bit, true, - __ATOMIC_ACQ_REL, __ATOMIC_RELAXED)) + if (__atomic_compare_exchange_n(gi, &expected, pending_bit, false, + __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED)) { // This thread should do the initialization. return 1; @@ -266,7 +267,7 @@ namespace __cxxabiv1 if (expected == pending_bit) { int newv = expected | waiting_bit; - if (!__atomic_compare_exchange_n(gi, &expected, newv, true, + if (!__atomic_compare_exchange_n(gi, &expected, newv, false, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED)) continue; -- cgit v1.1