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