| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #define MOJO_DEADLINE_INDEFINITE ((MojoDeadline) - 1) | 142 #define MOJO_DEADLINE_INDEFINITE ((MojoDeadline) - 1) |
| 143 #endif | 143 #endif |
| 144 | 144 |
| 145 // |MojoHandleSignals|: Used to specify signals that can be waited on for a | 145 // |MojoHandleSignals|: Used to specify signals that can be waited on for a |
| 146 // handle (and which can be triggered), e.g., the ability to read or write to | 146 // handle (and which can be triggered), e.g., the ability to read or write to |
| 147 // the handle. | 147 // the handle. |
| 148 // |MOJO_HANDLE_SIGNAL_NONE| - No flags. |MojoWait()|, etc. will return | 148 // |MOJO_HANDLE_SIGNAL_NONE| - No flags. |MojoWait()|, etc. will return |
| 149 // |MOJO_RESULT_FAILED_PRECONDITION| if you attempt to wait on this. | 149 // |MOJO_RESULT_FAILED_PRECONDITION| if you attempt to wait on this. |
| 150 // |MOJO_HANDLE_SIGNAL_READABLE| - Can read (e.g., a message) from the handle. | 150 // |MOJO_HANDLE_SIGNAL_READABLE| - Can read (e.g., a message) from the handle. |
| 151 // |MOJO_HANDLE_SIGNAL_WRITABLE| - Can write (e.g., a message) to the handle. | 151 // |MOJO_HANDLE_SIGNAL_WRITABLE| - Can write (e.g., a message) to the handle. |
| 152 // |MOJO_HANDLE_SIGNAL_PEER_CLOSED| - The peer handle is closed. |
| 152 | 153 |
| 153 typedef uint32_t MojoHandleSignals; | 154 typedef uint32_t MojoHandleSignals; |
| 154 | 155 |
| 155 #ifdef __cplusplus | 156 #ifdef __cplusplus |
| 156 const MojoHandleSignals MOJO_HANDLE_SIGNAL_NONE = 0; | 157 const MojoHandleSignals MOJO_HANDLE_SIGNAL_NONE = 0; |
| 157 const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE = 1 << 0; | 158 const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE = 1 << 0; |
| 158 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; |
| 159 #else | 161 #else |
| 160 #define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals)0) | 162 #define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals)0) |
| 161 #define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals)1 << 0) | 163 #define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals)1 << 0) |
| 162 #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) |
| 163 #endif | 166 #endif |
| 164 | 167 |
| 165 // TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany. | 168 // TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany. |
| 166 // Note: This struct is not extensible (and only has 32-bit quantities), so it's | 169 // Note: This struct is not extensible (and only has 32-bit quantities), so it's |
| 167 // 32-bit-aligned. | 170 // 32-bit-aligned. |
| 168 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); | 171 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); |
| 169 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { | 172 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { |
| 170 MojoHandleSignals satisfied_signals; | 173 MojoHandleSignals satisfied_signals; |
| 171 MojoHandleSignals satisfiable_signals; | 174 MojoHandleSignals satisfiable_signals; |
| 172 }; | 175 }; |
| 173 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, | 176 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, |
| 174 "MojoHandleSignalsState has wrong size"); | 177 "MojoHandleSignalsState has wrong size"); |
| 175 | 178 |
| 176 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 179 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
| OLD | NEW |