summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency/locker.h
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2018-02-06 12:05:21 -0500
committerXiangyu Yao <xiangyu.yao@mongodb.com>2018-02-09 15:54:48 -0500
commite28c2f4732e490ed8efa6148d20d889dfd603028 (patch)
treed89d407bd23960ce30a68fe17b2be0992245bd80 /src/mongo/db/concurrency/locker.h
parentb52615ee4e518bcb29bd0601d904fd9e059ce77e (diff)
downloadmongo-e28c2f4732e490ed8efa6148d20d889dfd603028.tar.gz
SERVER-32682 Use deadline-oriented mechanism for lock timeout
Diffstat (limited to 'src/mongo/db/concurrency/locker.h')
-rw-r--r--src/mongo/db/concurrency/locker.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/concurrency/locker.h b/src/mongo/db/concurrency/locker.h
index b16836bc5a1..dba13215eb1 100644
--- a/src/mongo/db/concurrency/locker.h
+++ b/src/mongo/db/concurrency/locker.h
@@ -116,11 +116,12 @@ public:
* Requests the global lock to be acquired in the specified mode.
*
* See the comments for lockBegin/Complete for more information on the semantics.
- * The timeout indicates how long to wait for the lock to be acquired. The lockGlobalBegin
- * method has a timeout for use with the TicketHolder, if there is one.
+ * The deadline indicates the absolute time point when this lock acquisition will time out, if
+ * not yet granted. The lockGlobalBegin
+ * method has a deadline for use with the TicketHolder, if there is one.
*/
- virtual LockResult lockGlobalBegin(LockMode mode, Milliseconds timeout) = 0;
- virtual LockResult lockGlobalComplete(Milliseconds timeout) = 0;
+ virtual LockResult lockGlobalBegin(LockMode mode, Date_t deadline) = 0;
+ virtual LockResult lockGlobalComplete(Date_t deadline) = 0;
/**
* This method is used only in the MMAP V1 storage engine, otherwise it is a no-op. See the
@@ -171,8 +172,8 @@ public:
*
* @param resId Id of the resource to be locked.
* @param mode Mode in which the resource should be locked. Lock upgrades are allowed.
- * @param timeout How long to wait for the lock to be granted, before
- * returning LOCK_TIMEOUT. This parameter defaults to an infinite timeout.
+ * @param deadline How long to wait for the lock to be granted, before
+ * returning LOCK_TIMEOUT. This parameter defaults to an infinite deadline.
* If Milliseconds(0) is passed, the request will return immediately, if
* the request could not be granted right away.
* @param checkDeadlock Whether to enable deadlock detection for this acquisition. This
@@ -183,7 +184,7 @@ public:
*/
virtual LockResult lock(ResourceId resId,
LockMode mode,
- Milliseconds timeout = Milliseconds::max(),
+ Date_t deadline = Date_t::max(),
bool checkDeadlock = false) = 0;
/**