From 1659623793b9d337e4061fc294ec258c99b1171e Mon Sep 17 00:00:00 2001 From: Jason Carey Date: Tue, 5 Mar 2019 10:47:33 -0500 Subject: 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. --- src/mongo/stdx/condition_variable.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mongo/stdx') 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: -- cgit v1.2.1