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 basic functions common to different Mojo system APIs. | 5 // This file contains basic functions common to different Mojo system APIs. |
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_WAIT_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_WAIT_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_WAIT_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_WAIT_H_ |
(...skipping 25 matching lines...) Expand all Loading... |
36 // satisfied). | 36 // satisfied). |
37 // |MOJO_RESULT_CANCELLED| if |handle| was closed (necessarily from another | 37 // |MOJO_RESULT_CANCELLED| if |handle| was closed (necessarily from another |
38 // thread) during the wait. | 38 // thread) during the wait. |
39 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle (e.g., if | 39 // |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle (e.g., if |
40 // it has already been closed). The |signals_state| value is unchanged. | 40 // it has already been closed). The |signals_state| value is unchanged. |
41 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of | 41 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of |
42 // the signals being satisfied. | 42 // the signals being satisfied. |
43 // |MOJO_RESULT_FAILED_PRECONDITION| if it becomes known that none of the | 43 // |MOJO_RESULT_FAILED_PRECONDITION| if it becomes known that none of the |
44 // signals in |signals| can ever be satisfied (e.g., when waiting on one | 44 // signals in |signals| can ever be satisfied (e.g., when waiting on one |
45 // end of a message pipe and the other end is closed). | 45 // end of a message pipe and the other end is closed). |
| 46 // |MOJO_RESULT_BUSY| if |handle| is currently in use in some transaction |
| 47 // (that, e.g., may result in it being invalidated, such as being sent in |
| 48 // a message). |
46 // | 49 // |
47 // If there are multiple waiters (on different threads, obviously) waiting on | 50 // If there are multiple waiters (on different threads, obviously) waiting on |
48 // the same handle and signal, and that signal becomes satisfied, all waiters | 51 // the same handle and signal, and that signal becomes satisfied, all waiters |
49 // will be awoken. | 52 // will be awoken. |
50 MojoResult MojoWait( | 53 MojoResult MojoWait( |
51 MojoHandle handle, // In. | 54 MojoHandle handle, // In. |
52 MojoHandleSignals signals, // In. | 55 MojoHandleSignals signals, // In. |
53 MojoDeadline deadline, // In. | 56 MojoDeadline deadline, // In. |
54 struct MojoHandleSignalsState* signals_state); // Optional out. | 57 struct MojoHandleSignalsState* signals_state); // Optional out. |
55 | 58 |
(...skipping 29 matching lines...) Expand all Loading... |
85 // another thread) during the wait. | 88 // another thread) during the wait. |
86 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if there are too many handles. The | 89 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if there are too many handles. The |
87 // |signals_state| array is unchanged. | 90 // |signals_state| array is unchanged. |
88 // |MOJO_RESULT_INVALID_ARGUMENT| if some |handle[i]| is not a valid handle | 91 // |MOJO_RESULT_INVALID_ARGUMENT| if some |handle[i]| is not a valid handle |
89 // (e.g., if it is zero or if it has already been closed). The | 92 // (e.g., if it is zero or if it has already been closed). The |
90 // |signals_state| array is unchanged. | 93 // |signals_state| array is unchanged. |
91 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of | 94 // |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline has passed without any of |
92 // handles satisfying any of its signals. | 95 // handles satisfying any of its signals. |
93 // |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that SOME | 96 // |MOJO_RESULT_FAILED_PRECONDITION| if it is or becomes impossible that SOME |
94 // |handle[i]| will ever satisfy any of the signals in |signals[i]|. | 97 // |handle[i]| will ever satisfy any of the signals in |signals[i]|. |
| 98 // |MOJO_RESULT_BUSY| if some |handle[i]| is currently in use in some |
| 99 // transaction (that, e.g., may result in it being invalidated, such as |
| 100 // being sent in a message). |
95 MojoResult MojoWaitMany(const MojoHandle* MOJO_RESTRICT handles, // In. | 101 MojoResult MojoWaitMany(const MojoHandle* MOJO_RESTRICT handles, // In. |
96 const MojoHandleSignals* MOJO_RESTRICT signals, // In. | 102 const MojoHandleSignals* MOJO_RESTRICT signals, // In. |
97 uint32_t num_handles, // In. | 103 uint32_t num_handles, // In. |
98 MojoDeadline deadline, // In. | 104 MojoDeadline deadline, // In. |
99 uint32_t* MOJO_RESTRICT result_index, // Optional out | 105 uint32_t* MOJO_RESTRICT result_index, // Optional out |
100 struct MojoHandleSignalsState* MOJO_RESTRICT | 106 struct MojoHandleSignalsState* MOJO_RESTRICT |
101 signals_states); // Optional out | 107 signals_states); // Optional out |
102 | 108 |
103 MOJO_END_EXTERN_C | 109 MOJO_END_EXTERN_C |
104 | 110 |
105 #endif // MOJO_PUBLIC_C_SYSTEM_WAIT_H_ | 111 #endif // MOJO_PUBLIC_C_SYSTEM_WAIT_H_ |
OLD | NEW |