get_fd


Description:

public int get_fd ()

Gets the file descriptor for a cancellable job.

This can be used to implement cancellable operations on Unix systems. The returned fd will turn readable when this is cancelled.

You are not supposed to read from the fd yourself, just check for readable status. Reading to unset the readable status is done with reset.

After a successful return from this function, you should use release_fd to free up resources allocated for the returned file descriptor.

See also make_pollfd.

Parameters:

this

a Cancellable.

Returns:

A valid file descriptor. `-1` if the file descriptor is not supported, or on errors.