OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Mojo system handle-related declarations/definitions. | 5 // This file contains Mojo system handle-related declarations/definitions. |
6 // | 6 // |
7 // Note: This header should be compilable as C. | 7 // Note: This header should be compilable as C. |
8 | 8 |
9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Note: This struct is not extensible (and only has 32-bit quantities), so it's | 48 // Note: This struct is not extensible (and only has 32-bit quantities), so it's |
49 // 32-bit-aligned. | 49 // 32-bit-aligned. |
50 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment"); | 50 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(uint32_t) == 4, "uint32_t has weird alignment"); |
51 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { | 51 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { |
52 MojoHandleSignals satisfied_signals; | 52 MojoHandleSignals satisfied_signals; |
53 MojoHandleSignals satisfiable_signals; | 53 MojoHandleSignals satisfiable_signals; |
54 }; | 54 }; |
55 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, | 55 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, |
56 "MojoHandleSignalsState has wrong size"); | 56 "MojoHandleSignalsState has wrong size"); |
57 | 57 |
58 #ifdef __cplusplus | 58 MOJO_BEGIN_EXTERN_C |
59 extern "C" { | |
60 #endif | |
61 | 59 |
62 // Closes the given |handle|. | 60 // Closes the given |handle|. |
63 // | 61 // |
64 // Returns: | 62 // Returns: |
65 // |MOJO_RESULT_OK| on success. | 63 // |MOJO_RESULT_OK| on success. |
66 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle. | 64 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle. |
67 // | 65 // |
68 // Concurrent operations on |handle| may succeed (or fail as usual) if they | 66 // Concurrent operations on |handle| may succeed (or fail as usual) if they |
69 // happen before the close, be cancelled with result |MOJO_RESULT_CANCELLED| if | 67 // happen before the close, be cancelled with result |MOJO_RESULT_CANCELLED| if |
70 // they properly overlap (this is likely the case with |MojoWait()|, etc.), or | 68 // they properly overlap (this is likely the case with |MojoWait()|, etc.), or |
71 // fail with |MOJO_RESULT_INVALID_ARGUMENT| if they happen after. | 69 // fail with |MOJO_RESULT_INVALID_ARGUMENT| if they happen after. |
72 MojoResult MojoClose(MojoHandle handle); | 70 MojoResult MojoClose(MojoHandle handle); |
73 | 71 |
74 #ifdef __cplusplus | 72 MOJO_END_EXTERN_C |
75 } // extern "C" | |
76 #endif | |
77 | 73 |
78 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ | 74 #endif // MOJO_PUBLIC_C_SYSTEM_HANDLE_H_ |
OLD | NEW |