summaryrefslogtreecommitdiff
path: root/src/mongo/stdx
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2019-03-05 10:47:33 -0500
committerJason Carey <jcarey@argv.me>2019-03-11 10:26:49 -0400
commit1659623793b9d337e4061fc294ec258c99b1171e (patch)
tree592a21f84eb6bbbf8ca025bd04b7ccee89dc6db1 /src/mongo/stdx
parentbe65d84da8e84ea99a1075339bd49a23a688d756 (diff)
downloadmongo-1659623793b9d337e4061fc294ec258c99b1171e.tar.gz
SERVER-39960 Simplify opCtx::markKilled
Operation context currently relies on an elaborate dance between the client lock, _waitMutex, _waitCV and _numKillers to allow markKilled to tap the condvar an opctx is waiting on. After the introduction of batons on all opctx's, this is no longer necessary (as batons have their own support for being woken, while waiting on a condvar). Removing the special killing code will simplify opctx, and remove a lot of extra book keeping.
Diffstat (limited to 'src/mongo/stdx')
-rw-r--r--src/mongo/stdx/condition_variable.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/stdx/condition_variable.h b/src/mongo/stdx/condition_variable.h
index 33e42f927fa..031d5005484 100644
--- a/src/mongo/stdx/condition_variable.h
+++ b/src/mongo/stdx/condition_variable.h
@@ -47,6 +47,19 @@ namespace mongo {
*/
class Notifyable {
public:
+ // !!! PAY ATTENTION, THERE IS DANGER HERE !!!
+ //
+ // Implementers of the notifyable api must be level triggered by notify, rather than edge
+ // triggered.
+ //
+ // I.e. a call to notify() must either unblock the notifyable immediately, if it is currently
+ // blocked, or unblock it the next time it would wait, if it is not currently blocked.
+ //
+ // In addition to unblocking, the notifyable should also atomically consume that notification
+ // state as a result of waking. I.e. any number of calls to notify before or during a wait must
+ // unblock exactly one wait.
+ //
+ // Notifyable::notify is not like condition_variable::notify_X()
virtual void notify() noexcept = 0;
protected: