summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-10-06 14:38:54 -0400
committerEliot Horowitz <eliot@10gen.com>2011-10-06 14:39:34 -0400
commitafa5bc3d0e47ed9f867ea2ef40637f6f13d0fb85 (patch)
tree25ce703559a4a2c15441582d4b35ca38d7ecdbc8
parent4eff1007c98e99b0ec0c51c5da3724138f65593b (diff)
downloadmongo-afa5bc3d0e47ed9f867ea2ef40637f6f13d0fb85.tar.gz
use SimpleMutex instead of SpinLock for record
-rw-r--r--db/record.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/db/record.cpp b/db/record.cpp
index 51dc52072dd..a8a3e43d024 100644
--- a/db/record.cpp
+++ b/db/record.cpp
@@ -112,7 +112,8 @@ namespace mongo {
class Rolling {
public:
- Rolling() {
+ Rolling()
+ : _lock( "ps::Rolling" ){
_curSlice = 0;
_lastRotate = Listener::getElapsedTimeMillis();
}
@@ -126,8 +127,8 @@ namespace mongo {
bool access( size_t region , short offset , bool doHalf ) {
int regionHash = hash(region);
- scoped_spinlock lk( _lock );
-
+ SimpleMutex::scoped_lock lk( _lock );
+
static int rarely_count = 0;
if ( rarely_count++ % 2048 == 0 ) {
long long now = Listener::getElapsedTimeMillis();
@@ -174,7 +175,7 @@ namespace mongo {
long long _lastRotate;
Slice _slices[NumSlices];
- SpinLock _lock;
+ SimpleMutex _lock;
} rolling;
}