OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains types and constants/macros common to different Mojo system | 5 // This file contains types and constants/macros common to different Mojo system |
6 // APIs. | 6 // APIs. |
7 // | 7 // |
8 // Note: This header should be compilable as C. | 8 // Note: This header should be compilable as C. |
9 | 9 |
10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE = 1 << 0; | 158 const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE = 1 << 0; |
159 const MojoHandleSignals MOJO_HANDLE_SIGNAL_WRITABLE = 1 << 1; | 159 const MojoHandleSignals MOJO_HANDLE_SIGNAL_WRITABLE = 1 << 1; |
160 const MojoHandleSignals MOJO_HANDLE_SIGNAL_PEER_CLOSED = 1 << 2; | 160 const MojoHandleSignals MOJO_HANDLE_SIGNAL_PEER_CLOSED = 1 << 2; |
161 #else | 161 #else |
162 #define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals)0) | 162 #define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals)0) |
163 #define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals)1 << 0) | 163 #define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals)1 << 0) |
164 #define MOJO_HANDLE_SIGNAL_WRITABLE ((MojoHandleSignals)1 << 1) | 164 #define MOJO_HANDLE_SIGNAL_WRITABLE ((MojoHandleSignals)1 << 1) |
165 #define MOJO_HANDLE_SIGNAL_PEER_CLOSED ((MojoHandleSignals)1 << 2) | 165 #define MOJO_HANDLE_SIGNAL_PEER_CLOSED ((MojoHandleSignals)1 << 2) |
166 #endif | 166 #endif |
167 | 167 |
168 // TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany. | 168 // |MojoHandleSignalsState|: Returned by wait functions to indicate the |
| 169 // signaling state of handles. Members are as follows: |
| 170 // - |satisfied signals|: Bitmask of signals that were satisfied at some time |
| 171 // before the call returned. |
| 172 // - |satisfiable signals|: These are the signals that are possible to |
| 173 // satisfy. For example, if the return value was |
| 174 // |MOJO_RESULT_FAILED_PRECONDITION|, you can use this field to |
| 175 // determine which, if any, of the signals can still be satisfied. |
169 // Note: This struct is not extensible (and only has 32-bit quantities), so it's | 176 // Note: This struct is not extensible (and only has 32-bit quantities), so it's |
170 // 32-bit-aligned. | 177 // 32-bit-aligned. |
171 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); | 178 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); |
172 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { | 179 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { |
173 MojoHandleSignals satisfied_signals; | 180 MojoHandleSignals satisfied_signals; |
174 MojoHandleSignals satisfiable_signals; | 181 MojoHandleSignals satisfiable_signals; |
175 }; | 182 }; |
176 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, | 183 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, |
177 "MojoHandleSignalsState has wrong size"); | 184 "MojoHandleSignalsState has wrong size"); |
178 | 185 |
179 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 186 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
OLD | NEW |