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

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

Issue 2076263003: Plumb the handle signals state to Awakable::Awake(). (Closed) Base URL: https://github.com/domokit/mojo.git@work794_wait_set_4.2
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 4194fe09c61a91fbff1d0f303f062f0abd14549e..cbd024078210a1752875992c110f4276129c4209 100644
--- a/mojo/edk/system/awakable.h
+++ b/mojo/edk/system/awakable.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "mojo/edk/system/handle_signals_state.h"
#include "mojo/public/c/system/result.h"
namespace mojo {
@@ -16,13 +17,23 @@ namespace system {
// implementation that blocks while waiting to be awoken.
class Awakable {
public:
+ enum class AwakeReason { SATISFIED, UNSATISFIABLE, CANCELLED };
+
+ // Helper function that translates:
+ // - |AwakeReason::SATISFIED| -> |MOJO_RESULT_OK|,
+ // - |AwakeReason::UNSATISFIABLE| -> |MOJO_RESULT_FAILED_PRECONDITION|, and
+ // - |AwakeReason::CANCELLED| -> |MOJO_RESULT_CANCELLED|.
+ 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(MojoResult result, uint64_t context) = 0;
+ virtual bool Awake(uint64_t context,
+ AwakeReason reason,
+ const HandleSignalsState& signals_state) = 0;
protected:
Awakable() {}
« 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