### Method

# Gio Cancellable get_fd

#### Declaration [src]

    int
    g_cancellable_get_fd (
      GCancellable* cancellable
    )

#### Description [src]

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 `cancellable` 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 g_cancellable_reset().

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

See also g_cancellable_make_pollfd().

#### Parameters

`cancellable`

  Type: `GCancellable`

  A `GCancellable`.

  The argument can be `NULL`.

#### Return value

Type: `int`

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