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

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

Issue 2075353002: Plumb the handle signals state out of Waiter::Wait(). (Closed) Base URL: https://github.com/domokit/mojo.git@work795_wait_set_4.3-x-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
Index: mojo/edk/system/waiter.h
diff --git a/mojo/edk/system/waiter.h b/mojo/edk/system/waiter.h
index 229214a80f5d8d1374b352787dce77a606a8d223..afe5b89ae587f4aab6704e1e86ff3f25e446efcd 100644
--- a/mojo/edk/system/waiter.h
+++ b/mojo/edk/system/waiter.h
@@ -34,28 +34,19 @@ class Waiter final : public Awakable {
// Waits until a suitable |Awake()| is called. (|context| may be null, in
// which case, obviously no context is ever returned.)
// Returns:
- // - The result given to the first call to |Awake()| (possibly before this
- // call to |Wait()|); in this case, |*context| is set to the value passed
- // to that call to |Awake()|.
- // - |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline was exceeded; in this
- // case |*context| is not modified.
+ // - |MOJO_RESULT_OK| if |Awake()| was called with |AwakeReason::SATISFIED|;
+ // - |MOJO_RESULT_CANCELLED| if |Awake()| was called with
+ // |AwakeReason::CANCELLED|;
+ // - |MOJO_RESULT_FAILED_PRECONDITION| if |Awake()| was called with
+ // |AwakeReason::UNSATISFIABLE|; or
+ // - |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline was exceeded.
//
- // Usually, the context passed to |Awake()| will be the value passed to
- // |Dispatcher::AddAwakable()|, which is usually the index to the array of
- // handles passed to |MojoWaitMany()| (or 0 for |MojoWait()|).
- //
- // Typical |Awake()| results are:
- // - |MOJO_RESULT_OK| if one of the flags passed to
- // |MojoWait()|/|MojoWaitMany()| (hence |Dispatcher::AddAwakable()|) was
- // satisfied;
- // - |MOJO_RESULT_CANCELLED| if a handle (on which
- // |MojoWait()|/|MojoWaitMany()| was called) was closed (hence the
- // dispatcher closed); and
- // - |MOJO_RESULT_FAILED_PRECONDITION| if one of the set of flags passed to
- // |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by
- // the corresponding handle (e.g., if the other end of a message or data
- // pipe is closed).
- MojoResult Wait(MojoDeadline deadline, uint64_t* context);
+ // In all the cases except |MOJO_RESULT_DEADLINE_EXCEEDED|, the context and
+ // signals state passed to |Awake()| be made available via |*context| and
+ // |*signals_state|, respectively (unless the respective pointer is null).
+ MojoResult Wait(MojoDeadline deadline,
+ uint64_t* context,
+ HandleSignalsState* signals_state);
// |Awakable| implementation:
bool Awake(uint64_t context,
@@ -69,7 +60,8 @@ class Waiter final : public Awakable {
bool initialized_ MOJO_GUARDED_BY(mutex_);
#endif
bool awoken_ MOJO_GUARDED_BY(mutex_);
- MojoResult awake_result_ MOJO_GUARDED_BY(mutex_);
+ AwakeReason awake_reason_ MOJO_GUARDED_BY(mutex_);
+ HandleSignalsState signals_state_ MOJO_GUARDED_BY(mutex_);
uint64_t awake_context_ MOJO_GUARDED_BY(mutex_);
MOJO_DISALLOW_COPY_AND_ASSIGN(Waiter);

Powered by Google App Engine
This is Rietveld 408576698