| 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 #ifndef MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ | 5 #ifndef MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ |
| 6 #define MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ | 6 #define MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ |
| 7 | 7 |
| 8 #include "mojo/public/c/system/types.h" | 8 #include "mojo/public/c/system/types.h" |
| 9 | 9 |
| 10 typedef uintptr_t MojoAsyncWaitID; | 10 typedef uintptr_t MojoAsyncWaitID; |
| 11 | 11 |
| 12 typedef void (*MojoAsyncWaitCallback)(void* closure, MojoResult result); | 12 typedef void (*MojoAsyncWaitCallback)(void* closure, MojoResult result); |
| 13 | 13 |
| 14 struct MojoAsyncWaiter { | 14 struct MojoAsyncWaiter { |
| 15 // Asynchronously call MojoWait on a background thread, and pass the result | 15 // Asynchronously call MojoWait on a background thread, and pass the result |
| 16 // of MojoWait to the given MojoAsyncWaitCallback on the current thread. | 16 // of MojoWait to the given MojoAsyncWaitCallback on the current thread. |
| 17 // Returns a non-zero MojoAsyncWaitID that can be used with CancelWait to | 17 // Returns a non-zero MojoAsyncWaitID that can be used with CancelWait to |
| 18 // stop waiting. This identifier becomes invalid once the callback runs. | 18 // stop waiting. This identifier becomes invalid once the callback runs. |
| 19 MojoAsyncWaitID (*AsyncWait)(MojoHandle handle, | 19 MojoAsyncWaitID (*AsyncWait)(MojoHandle handle, |
| 20 MojoWaitFlags flags, | 20 MojoHandleSignals signals, |
| 21 MojoDeadline deadline, | 21 MojoDeadline deadline, |
| 22 MojoAsyncWaitCallback callback, | 22 MojoAsyncWaitCallback callback, |
| 23 void* closure); | 23 void* closure); |
| 24 | 24 |
| 25 // Cancel an existing call to AsyncWait with the given MojoAsyncWaitID. The | 25 // Cancel an existing call to AsyncWait with the given MojoAsyncWaitID. The |
| 26 // corresponding MojoAsyncWaitCallback will not be called in this case. | 26 // corresponding MojoAsyncWaitCallback will not be called in this case. |
| 27 void (*CancelWait)(MojoAsyncWaitID wait_id); | 27 void (*CancelWait)(MojoAsyncWaitID wait_id); |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 #endif // MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ | 30 #endif // MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ |
| OLD | NEW |