1
//===----------------------------------------------------------------------===//
3
// The LLVM Compiler Infrastructure
5
// This file is dual licensed under the MIT and the University of Illinois Open
6
// Source Licenses. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
16
// atomic_compare_exchange_strong_explicit(shared_ptr<T>* p, shared_ptr<T>* v,
17
// shared_ptr<T> w, memory_order success,
18
// memory_order failure);
25
#if __has_feature(cxx_atomic)
27
std::shared_ptr<int> p(new int(4));
28
std::shared_ptr<int> v(new int(3));
29
std::shared_ptr<int> w(new int(2));
30
bool b = std::atomic_compare_exchange_strong_explicit(&p, &v, w,
31
std::memory_order_seq_cst,
32
std::memory_order_seq_cst);
39
std::shared_ptr<int> p(new int(4));
40
std::shared_ptr<int> v = p;
41
std::shared_ptr<int> w(new int(2));
42
bool b = std::atomic_compare_exchange_strong_explicit(&p, &v, w,
43
std::memory_order_seq_cst,
44
std::memory_order_seq_cst);