summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbcommands.cpp
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2012-02-28 17:28:49 -0500
committerDwight <dwight@10gen.com>2012-02-28 17:28:49 -0500
commitebeba7866b46a438877f25dc16d878f8d708c3eb (patch)
tree4a6f7cddb93f00f0f1867fb1b0b6d1e64bc6cb4b /src/mongo/db/dbcommands.cpp
parent95b58dea790f1cc7e7d5bb0e93c5ff5986bfbeec (diff)
downloadmongo-ebeba7866b46a438877f25dc16d878f8d708c3eb.tar.gz
SERVER-4328 use a mutex of its own for OpTime::now. we stay in the mutex for a while after grabbing an optime so that we dont have to reason too much about different threads grabbing optimes and then using them out of order.
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r--src/mongo/db/dbcommands.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index 49241865972..3344814524e 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -639,8 +639,8 @@ namespace mongo {
virtual LockType locktype() const { return NONE; }
CmdGetOpTime() : Command("getoptime") { }
bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
- writelock l( "" );
- result.appendDate("optime", OpTime::now().asDate());
+ mutex::scoped_lock lk(OpTime::m);
+ result.appendDate("optime", OpTime::now(lk).asDate());
return true;
}
} cmdgetoptime;