Permalink
Browse files

use SimpleMutex instead of SpinLock for record

  • Loading branch information...
1 parent 4eff100 commit afa5bc3d0e47ed9f867ea2ef40637f6f13d0fb85 @erh erh committed Oct 6, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 db/record.cpp
View
@@ -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;
}

0 comments on commit afa5bc3

Please sign in to comment.