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

Side by Side Diff: mojo/public/c/system/types.h

Issue 741503003: Adding MOJO_HANDLE_SIGNAL_PEER_CLOSED to be notified when a peer is closed. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
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
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_CLOSED| - The remote handle is closed.
viettrungluu 2014/11/25 18:37:12 Maybe it should be ..._REMOTE_CLOSED, to make it c
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_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_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_
OLDNEW
« no previous file with comments | « mojo/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/public/java/system/src/org/chromium/mojo/system/Core.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698