Home | History | Annotate | Download | only in system
      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
      3 // found in the LICENSE file.
      4 
      5 package org.chromium.mojo.system;
      6 
      7 import org.chromium.mojo.system.Core.HandleSignals;
      8 
      9 /**
     10  * Watches a handle for signals being satisfied.
     11  */
     12 public interface Watcher {
     13     /**
     14      * Callback passed to {@link Watcher#start}.
     15      */
     16     public interface Callback {
     17         /**
     18          * Called when the handle is ready.
     19          */
     20         public void onResult(int result);
     21     }
     22 
     23     /**
     24      * Starts watching a handle.
     25      */
     26     int start(Handle handle, HandleSignals signals, Callback callback);
     27 
     28     /**
     29      * Cancels an already-started watch.
     30      */
     31     void cancel();
     32 
     33     /**
     34      * Destroys the underlying implementation. Other methods will fail after destroy has been
     35      * called.
     36      */
     37     void destroy();
     38 }
     39