Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1630)

Unified Diff: mojo/edk/system/awakable.h

Issue 2088833003: Add different behavior to AwakableList for "persistent" vs "one-shot" awakables. (Closed) Base URL: https://github.com/domokit/mojo.git@work793_wait_set_4.5
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/async_waiter.cc ('k') | mojo/edk/system/awakable.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/awakable.h
diff --git a/mojo/edk/system/awakable.h b/mojo/edk/system/awakable.h
index cbd024078210a1752875992c110f4276129c4209..b4524f245295e439fc0bc26bcf6a40e44fe5762d 100644
--- a/mojo/edk/system/awakable.h
+++ b/mojo/edk/system/awakable.h
@@ -17,21 +17,24 @@ namespace system {
// implementation that blocks while waiting to be awoken.
class Awakable {
public:
- enum class AwakeReason { SATISFIED, UNSATISFIABLE, CANCELLED };
+ // See |AwakableList| (in particular its |Add()| method).
+ enum class AwakeReason { SATISFIED, UNSATISFIABLE, CANCELLED, CHANGED };
// Helper function that translates:
// - |AwakeReason::SATISFIED| -> |MOJO_RESULT_OK|,
// - |AwakeReason::UNSATISFIABLE| -> |MOJO_RESULT_FAILED_PRECONDITION|, and
// - |AwakeReason::CANCELLED| -> |MOJO_RESULT_CANCELLED|.
+ // - |AwakeReason::CHANGED| -> |MOJO_RESULT_INTERNAL| (this function never
+ // be called with this reason).
static MojoResult MojoResultForAwakeReason(AwakeReason reason);
// |Awake()| must satisfy the following contract:
// - It must be thread-safe.
// - Since it is called with a mutex held, it must not call anything that
// takes "non-terminal" locks, i.e., those which are always safe to take.
- // - It should return false if it must not be called again for the same
- // reason (e.g., for the same call to |AwakableList::Add()|).
- virtual bool Awake(uint64_t context,
+ // If |reason| is |AwakeReason::CANCELLED|, |Awake()| will not be called
+ // again (by the same source).
+ virtual void Awake(uint64_t context,
AwakeReason reason,
const HandleSignalsState& signals_state) = 0;
« no previous file with comments | « mojo/edk/system/async_waiter.cc ('k') | mojo/edk/system/awakable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698