summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2009-12-01 20:06:50 -0500
committerMathias Stearn <mathias@10gen.com>2009-12-01 20:08:34 -0500
commit31723f3d28d9c8b2d08a3ffcce23751f70a8b153 (patch)
tree2a329b9f3cac5b99ff74ddc5880b4c84c07e7136
parent7133196d6b90f71926af0ba69190dc5fb26fb328 (diff)
downloadmongo-31723f3d28d9c8b2d08a3ffcce23751f70a8b153.tar.gz
working atomic increment
-rw-r--r--stdafx.h1
-rw-r--r--util/goodies.h13
2 files changed, 2 insertions, 12 deletions
diff --git a/stdafx.h b/stdafx.h
index 5352c5e4d58..f0558378ff9 100644
--- a/stdafx.h
+++ b/stdafx.h
@@ -99,6 +99,7 @@ namespace mongo {
#include <boost/program_options.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr.hpp>
+#include <boost/interprocess/detail/atomic.hpp>
#define BOOST_SPIRIT_THREADSAFE
#include <boost/version.hpp>
diff --git a/util/goodies.h b/util/goodies.h
index eb0631061a6..30013de867b 100644
--- a/util/goodies.h
+++ b/util/goodies.h
@@ -19,10 +19,6 @@
#pragma once
-#if defined(__MSCV__)
-# include <windows.h>
-#endif
-
namespace mongo {
#if !defined(_WIN32) && !defined(NOEXECINFO)
@@ -122,14 +118,7 @@ namespace mongo {
}
WrappingInt atomicIncrement(){
-#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
- return __sync_add_and_fetch(&x, 1);
-#elif defined(__MSCV__)
- return InterlockedIncrement((long*)&x); //long is 32bits in Win64
-#else
-# warning "OID and MSGID generation will not be thread safe"
- return ++inc;
-#endif
+ return boost::interprocess::detail::atomic_inc32(&x);
}
static int diff(unsigned a, unsigned b) {