summaryrefslogtreecommitdiff
path: root/src/mongo/client/connpool.h
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2014-05-14 13:45:25 -0400
committerAndrew Morrow <acm@mongodb.com>2014-05-17 15:46:27 -0400
commit545d8d8420d7cf7f25514cf8b2ec1cabfbda6747 (patch)
treea18aa4fb7593d586c6025e779472e7e6f5e56230 /src/mongo/client/connpool.h
parent41d8623717159868eb952ae44cde8f8d3d1e6b52 (diff)
downloadmongo-545d8d8420d7cf7f25514cf8b2ec1cabfbda6747.tar.gz
SERVER-6018 Replace AtomicUInt with AtomicUInt32 in connpool
Diffstat (limited to 'src/mongo/client/connpool.h')
-rw-r--r--src/mongo/client/connpool.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h
index 0e2e5d47566..09d5fb78b52 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -33,6 +33,7 @@
#include "mongo/client/dbclientinterface.h"
#include "mongo/client/export_macros.h"
+#include "mongo/platform/atomic_word.h"
#include "mongo/platform/cstdint.h"
#include "mongo/util/background.h"
@@ -268,8 +269,8 @@ namespace mongo {
class MONGO_CLIENT_API AScopedConnection : boost::noncopyable {
public:
- AScopedConnection() { _numConnections++; }
- virtual ~AScopedConnection() { _numConnections--; }
+ AScopedConnection() { _numConnections.fetchAndAdd(1); }
+ virtual ~AScopedConnection() { _numConnections.fetchAndAdd(-1); }
virtual DBClientBase* get() = 0;
virtual void done() = 0;
@@ -283,10 +284,10 @@ namespace mongo {
/**
* @return total number of current instances of AScopedConnection
*/
- static int getNumConnections() { return _numConnections; }
+ static int getNumConnections() { return _numConnections.load(); }
private:
- static AtomicUInt _numConnections;
+ static AtomicInt32 _numConnections;
};
/** Use to get a connection from the pool. On exceptions things