[atomics.order]

llvm-svn: 114966
This commit is contained in:
Howard Hinnant 2010-09-28 17:13:38 +00:00
parent 0ab27ea44f
commit cfe0b0a1ab
5 changed files with 97 additions and 2 deletions

View File

@ -21,8 +21,12 @@ namespace std
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
memory_order_relaxed,
memory_order_consume, // load-consume
memory_order_acquire, // load-acquire
memory_order_release, // store-release
memory_order_acq_rel, // store-release load-acquire
memory_order_seq_cst // store-release load-acquire
} memory_order;
template <class T> T kill_dependency(T y);
@ -2412,6 +2416,19 @@ void atomic_signal_fence(memory_order);
_LIBCPP_BEGIN_NAMESPACE_STD
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
kill_dependency(_Tp __y)
{
return __y;
}
_LIBCPP_END_NAMESPACE_STD

View File

@ -0,0 +1,13 @@
// -*- C++ -*-
//===-------------------------- algorithm ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}

View File

@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T> T kill_dependency(T y);
#include <atomic>
#include <cassert>
int main()
{
assert(std::kill_dependency(5) == 5);
assert(std::kill_dependency(-5.5) == -5.5);
}

View File

@ -0,0 +1,31 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef enum memory_order
// {
// memory_order_relaxed, memory_order_consume, memory_order_acquire,
// memory_order_release, memory_order_acq_rel, memory_order_seq_cst
// } memory_order;
#include <atomic>
#include <cassert>
int main()
{
assert(std::memory_order_relaxed == 0);
assert(std::memory_order_consume == 1);
assert(std::memory_order_acquire == 2);
assert(std::memory_order_release == 3);
assert(std::memory_order_acq_rel == 4);
assert(std::memory_order_seq_cst == 5);
std::memory_order o = std::memory_order_seq_cst;
assert(o == 5);
}

View File

@ -0,0 +1,13 @@
// -*- C++ -*-
//===-------------------------- algorithm ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}