共用方式為


SelectionKey.Cancel Method

Definition

Requests that the registration of this key's channel with its selector be cancelled.

[Android.Runtime.Register("cancel", "()V", "GetCancelHandler")]
public abstract void Cancel ();
[<Android.Runtime.Register("cancel", "()V", "GetCancelHandler")>]
abstract member Cancel : unit -> unit
Attributes

Remarks

Requests that the registration of this key's channel with its selector be cancelled. Upon return the key will be invalid and will have been added to its selector's cancelled-key set. The key will be removed from all of the selector's key sets during the next selection operation.

If this key has already been cancelled then invoking this method has no effect. Once cancelled, a key remains forever invalid.

This method may be invoked at any time. It synchronizes on the selector's cancelled-key set, and therefore may block briefly if invoked concurrently with a cancellation or selection operation involving the same selector.

Java documentation for java.nio.channels.SelectionKey.cancel().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to