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 package org.chromium.mojo.system; | 5 package org.chromium.mojo.system; |
6 | 6 |
7 import org.chromium.mojo.system.Core.WaitResult; | 7 import org.chromium.mojo.system.Core.HandleSignalsState; |
8 | 8 |
9 import java.io.Closeable; | 9 import java.io.Closeable; |
10 | 10 |
11 /** | 11 /** |
12 * A generic mojo handle. | 12 * A generic mojo handle. |
13 */ | 13 */ |
14 public interface Handle extends Closeable { | 14 public interface Handle extends Closeable { |
15 | 15 |
16 /** | 16 /** |
17 * Closes the given |handle|. | 17 * Closes the given |handle|. |
18 * <p> | 18 * <p> |
19 * Concurrent operations on |handle| may succeed (or fail as usual) if they
happen before the | 19 * Concurrent operations on |handle| may succeed (or fail as usual) if they
happen before the |
20 * close, be cancelled with result |MojoResult.CANCELLED| if they properly o
verlap (this is | 20 * close, be cancelled with result |MojoResult.CANCELLED| if they properly o
verlap (this is |
21 * likely the case with |wait()|, etc.), or fail with |MojoResult.INVALID_AR
GUMENT| if they | 21 * likely the case with |wait()|, etc.), or fail with |MojoResult.INVALID_AR
GUMENT| if they |
22 * happen after. | 22 * happen after. |
23 */ | 23 */ |
24 @Override | 24 @Override |
25 public void close(); | 25 public void close(); |
26 | 26 |
27 /** | 27 /** |
28 * @see Core#wait(Handle, Core.HandleSignals, long) | 28 * @return the last known signaling state of the handle. |
29 */ | 29 */ |
30 public WaitResult wait(Core.HandleSignals signals, long deadline); | 30 public HandleSignalsState querySignalsState(); |
31 | 31 |
32 /** | 32 /** |
33 * @return whether the handle is valid. A handle is valid until it has been
explicitly closed or | 33 * @return whether the handle is valid. A handle is valid until it has been
explicitly closed or |
34 * send through a message pipe via |MessagePipeHandle.writeMessage|. | 34 * send through a message pipe via |MessagePipeHandle.writeMessage|. |
35 */ | 35 */ |
36 public boolean isValid(); | 36 public boolean isValid(); |
37 | 37 |
38 /** | 38 /** |
39 * Converts this handle into an {@link UntypedHandle}, invalidating this han
dle. | 39 * Converts this handle into an {@link UntypedHandle}, invalidating this han
dle. |
40 */ | 40 */ |
(...skipping 11 matching lines...) Expand all Loading... |
52 */ | 52 */ |
53 public Handle pass(); | 53 public Handle pass(); |
54 | 54 |
55 /** | 55 /** |
56 * Releases the native handle backed by this {@link Handle}. The caller owns
the handle and must | 56 * Releases the native handle backed by this {@link Handle}. The caller owns
the handle and must |
57 * close it. | 57 * close it. |
58 */ | 58 */ |
59 public int releaseNativeHandle(); | 59 public int releaseNativeHandle(); |
60 | 60 |
61 } | 61 } |
OLD | NEW |