summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-10-04 18:52:54 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-10-04 18:52:54 +0000
commit2b672e24a55a282855757997d0e11535500dd555 (patch)
treeed37fa9c1af9e01413dda816b9099211653691e8 /libcxx/src
parentb2c4ca64334599762d840ebd396090ac4bd076af (diff)
downloadbcm5719-llvm-2b672e24a55a282855757997d0e11535500dd555.tar.gz
bcm5719-llvm-2b672e24a55a282855757997d0e11535500dd555.zip
Still working on the basic design of <atomic>. I'm working towards a system by which the compiler only needs to define the strongest intrinsics it can. Weaker atomics in the library automatically try stronger and stronger variants, picking the weakest compiler intrinsic available. If no compiler intrinsics are available for a given operation, the library locks a mutex and does the job. Better documentation to follow...
llvm-svn: 115538
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/atomic.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/libcxx/src/atomic.cpp b/libcxx/src/atomic.cpp
new file mode 100644
index 00000000000..dc354df2303
--- /dev/null
+++ b/libcxx/src/atomic.cpp
@@ -0,0 +1,23 @@
+//===------------------------- atomic.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "__mutex_base"
+#include "atomic"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+_LIBCPP_VISIBLE
+mutex&
+__not_atomic_mut()
+{
+ static mutex m;
+ return m;
+}
+
+_LIBCPP_END_NAMESPACE_STD
OpenPOWER on IntegriCloud