| 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 functions for waiting on multiple handles using wait sets. | 5 // This file contains functions for waiting on multiple handles using wait sets. |
| 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_SET_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_WAIT_SET_H_ |
| 10 #define MOJO_PUBLIC_C_SYSTEM_WAIT_SET_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_WAIT_SET_H_ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // | 74 // |
| 75 // If |options| is null, the default options will be used. | 75 // If |options| is null, the default options will be used. |
| 76 // | 76 // |
| 77 // Returns: | 77 // Returns: |
| 78 // |MOJO_RESULT_OK| if a wait set was successfully created. On success, | 78 // |MOJO_RESULT_OK| if a wait set was successfully created. On success, |
| 79 // |*handle| will be the handle of the wait set. | 79 // |*handle| will be the handle of the wait set. |
| 80 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., | 80 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., |
| 81 // |options| is non null and |*options| is invalid). | 81 // |options| is non null and |*options| is invalid). |
| 82 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if a process/system/quota/etc. limit has | 82 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if a process/system/quota/etc. limit has |
| 83 // been reached. | 83 // been reached. |
| 84 // |MOJO_ERROR_CODE_UNIMPLEMENTED| if some unknown/unsupported option has been |
| 85 // specified in |*options|. |
| 84 MojoResult MojoCreateWaitSet(const struct MojoCreateWaitSetOptions* | 86 MojoResult MojoCreateWaitSet(const struct MojoCreateWaitSetOptions* |
| 85 MOJO_RESTRICT options, // Optional in. | 87 MOJO_RESTRICT options, // Optional in. |
| 86 MojoHandle* handle); // Out. | 88 MojoHandle* handle); // Out. |
| 87 | 89 |
| 88 // |MojoWaitSetAdd()|: Adds an entry to watch for to the wait set specified by | 90 // |MojoWaitSetAdd()|: Adds an entry to watch for to the wait set specified by |
| 89 // |wait_set_handle| (which must have the |MOJO_HANDLE_RIGHT_WRITE| right). | 91 // |wait_set_handle| (which must have the |MOJO_HANDLE_RIGHT_WRITE| right). |
| 90 // | 92 // |
| 91 // An entry in a wait set is composed of a handle, a signal set, and a | 93 // An entry in a wait set is composed of a handle, a signal set, and a |
| 92 // caller-specified cookie value. The cookie value must be unique across all | 94 // caller-specified cookie value. The cookie value must be unique across all |
| 93 // entries in a particular wait set but is otherwise opaque and can be any value | 95 // entries in a particular wait set but is otherwise opaque and can be any value |
| 94 // that is useful to the caller. If |options| is null the default options will | 96 // that is useful to the caller. If |options| is null the default options will |
| 95 // be used. | 97 // be used. |
| 96 // | 98 // |
| 97 // In all failure cases the wait set is unchanged. | 99 // In all failure cases the wait set is unchanged. |
| 98 // | 100 // |
| 99 // Returns: | 101 // Returns: |
| 100 // |MOJO_RESULT_OK| if the handle was added to the wait set. | 102 // |MOJO_RESULT_OK| if the handle was added to the wait set. |
| 101 // |MOJO_RESULT_INVALID_ARGUMENT| if |wait_set_handle| or |handle| do not | 103 // |MOJO_RESULT_INVALID_ARGUMENT| if |wait_set_handle| or |handle| do not |
| 102 // refer to valid handles, |wait_set_handle| is not a handle to a wait | 104 // refer to valid handles, |wait_set_handle| is not a handle to a wait |
| 103 // set, or |options| is not null and |*options| is not a valid options | 105 // set, or |options| is not null and |*options| is not a valid options |
| 104 // structure. | 106 // structure. |
| 105 // |MOJO_RESULT_ALREADY_EXISTS| if there is already an entry in the wait set | 107 // |MOJO_RESULT_ALREADY_EXISTS| if there is already an entry in the wait set |
| 106 // with the same |cookie| value. | 108 // with the same |cookie| value. |
| 107 // |MOJO_RESULT_BUSY| if |wait_set_handle| or |handle| are currently in use in | 109 // |MOJO_RESULT_BUSY| if |wait_set_handle| or |handle| are currently in use in |
| 108 // some transaction. | 110 // some transaction. |
| 109 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the handle could not be added due to | 111 // |MOJO_RESULT_RESOURCE_EXHAUSTED| if the handle could not be added due to |
| 110 // hitting a system or quota limitation. | 112 // hitting a system or quota limitation. |
| 113 // |MOJO_ERROR_CODE_UNIMPLEMENTED| if some unknown/unsupported option has been |
| 114 // specified in |*options|. |
| 111 MojoResult MojoWaitSetAdd(MojoHandle wait_set_handle, // In. | 115 MojoResult MojoWaitSetAdd(MojoHandle wait_set_handle, // In. |
| 112 MojoHandle handle, // In. | 116 MojoHandle handle, // In. |
| 113 MojoHandleSignals signals, // In. | 117 MojoHandleSignals signals, // In. |
| 114 uint64_t cookie, // In. | 118 uint64_t cookie, // In. |
| 115 const struct MojoWaitSetAddOptions* MOJO_RESTRICT | 119 const struct MojoWaitSetAddOptions* MOJO_RESTRICT |
| 116 options); // Optional in. | 120 options); // Optional in. |
| 117 | 121 |
| 118 // |MojoWaitSetRemove()|: Removes an entry from the wait set specified by | 122 // |MojoWaitSetRemove()|: Removes an entry from the wait set specified by |
| 119 // |wait_set_handle| (which must have the |MOJO_HANDLE_RIGHT_WRITE| right). | 123 // |wait_set_handle| (which must have the |MOJO_HANDLE_RIGHT_WRITE| right). |
| 120 // | 124 // |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 MojoResult MojoWaitSetWait( | 183 MojoResult MojoWaitSetWait( |
| 180 MojoHandle wait_set_handle, // In. | 184 MojoHandle wait_set_handle, // In. |
| 181 MojoDeadline deadline, // In. | 185 MojoDeadline deadline, // In. |
| 182 uint32_t* MOJO_RESTRICT num_results, // In/out. | 186 uint32_t* MOJO_RESTRICT num_results, // In/out. |
| 183 struct MojoWaitSetResult* MOJO_RESTRICT results, // Out. | 187 struct MojoWaitSetResult* MOJO_RESTRICT results, // Out. |
| 184 uint32_t* MOJO_RESTRICT max_results); // Optional out. | 188 uint32_t* MOJO_RESTRICT max_results); // Optional out. |
| 185 | 189 |
| 186 MOJO_END_EXTERN_C | 190 MOJO_END_EXTERN_C |
| 187 | 191 |
| 188 #endif // MOJO_PUBLIC_C_SYSTEM_WAIT_SET_H_ | 192 #endif // MOJO_PUBLIC_C_SYSTEM_WAIT_SET_H_ |
| OLD | NEW |