summaryrefslogtreecommitdiff
path: root/util/goodies.h
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 /util/goodies.h
parent7133196d6b90f71926af0ba69190dc5fb26fb328 (diff)
downloadmongo-31723f3d28d9c8b2d08a3ffcce23751f70a8b153.tar.gz
working atomic increment
Diffstat (limited to 'util/goodies.h')
-rw-r--r--util/goodies.h13
1 files changed, 1 insertions, 12 deletions
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) {