OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_EDK_SYSTEM_WAITER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_WAITER_H_ |
6 #define MOJO_EDK_SYSTEM_WAITER_H_ | 6 #define MOJO_EDK_SYSTEM_WAITER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // |MojoWait()|/|MojoWaitMany()| was called) was closed (hence the | 51 // |MojoWait()|/|MojoWaitMany()| was called) was closed (hence the |
52 // dispatcher closed); and | 52 // dispatcher closed); and |
53 // - |MOJO_RESULT_FAILED_PRECONDITION| if one of the set of flags passed to | 53 // - |MOJO_RESULT_FAILED_PRECONDITION| if one of the set of flags passed to |
54 // |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by | 54 // |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by |
55 // the corresponding handle (e.g., if the other end of a message or data | 55 // the corresponding handle (e.g., if the other end of a message or data |
56 // pipe is closed). | 56 // pipe is closed). |
57 MojoResult Wait(MojoDeadline deadline, uint32_t* context); | 57 MojoResult Wait(MojoDeadline deadline, uint32_t* context); |
58 | 58 |
59 // Wake the waiter up with the given result and context (or no-op if it's been | 59 // Wake the waiter up with the given result and context (or no-op if it's been |
60 // woken up already). | 60 // woken up already). |
61 void Awake(MojoResult result, uintptr_t context) override; | 61 bool Awake(MojoResult result, uintptr_t context) override; |
62 | 62 |
63 private: | 63 private: |
64 base::ConditionVariable cv_; // Associated to |lock_|. | 64 base::ConditionVariable cv_; // Associated to |lock_|. |
65 base::Lock lock_; // Protects the following members. | 65 base::Lock lock_; // Protects the following members. |
66 #ifndef NDEBUG | 66 #ifndef NDEBUG |
67 bool initialized_; | 67 bool initialized_; |
68 #endif | 68 #endif |
69 bool awoken_; | 69 bool awoken_; |
70 MojoResult awake_result_; | 70 MojoResult awake_result_; |
71 uintptr_t awake_context_; | 71 uintptr_t awake_context_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(Waiter); | 73 DISALLOW_COPY_AND_ASSIGN(Waiter); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace system | 76 } // namespace system |
77 } // namespace mojo | 77 } // namespace mojo |
78 | 78 |
79 #endif // MOJO_EDK_SYSTEM_WAITER_H_ | 79 #endif // MOJO_EDK_SYSTEM_WAITER_H_ |
OLD | NEW |