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