summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency/lock_manager_defs.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-01-21 15:03:02 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-01-26 12:34:07 -0500
commitfe3e92d4257b30f01b62d4ef941686b7e0138a8c (patch)
tree00ab59aeddf0e1b6bbbf655e84d9f0b4e1dd6501 /src/mongo/db/concurrency/lock_manager_defs.h
parent78390e4da7e48532194cba623c55d566bc09cc70 (diff)
downloadmongo-fe3e92d4257b30f01b62d4ef941686b7e0138a8c.tar.gz
SERVER-16773 Get rid of ScopedLock and 2 memory allocations
This change removes ScopedLock from the RAII lock objects' hierarchy. This eliminates two memory allocations and two acquisitions of the Parallel Batch Writer mutex. I did not see any significant performance improvement, but next change would be to remove the allocation of the PBR mutex as well and also to make WriteBatchExecutor not allocate lock objects.
Diffstat (limited to 'src/mongo/db/concurrency/lock_manager_defs.h')
-rw-r--r--src/mongo/db/concurrency/lock_manager_defs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/concurrency/lock_manager_defs.h b/src/mongo/db/concurrency/lock_manager_defs.h
index 7759ab193d7..9e7e2545f3d 100644
--- a/src/mongo/db/concurrency/lock_manager_defs.h
+++ b/src/mongo/db/concurrency/lock_manager_defs.h
@@ -84,6 +84,13 @@ namespace mongo {
*/
bool isModeCovered(LockMode mode, LockMode coveringMode);
+ /**
+ * Returns whether the passed in mode is S or IS. Used for validation checks.
+ */
+ inline bool isSharedLockMode(LockMode mode) {
+ return (mode == MODE_IS || mode == MODE_S);
+ }
+
/**
* Return values for the locking functions of the lock manager.