GLib.io_create_watch
Description: Reference for GLib.io_create_watch

### Function

# GLibio_create_watch

#### Declaration [src]

    GSource*
    g_io_create_watch (
      GIOChannel* channel,
      GIOCondition condition
    )

#### Description [src]

Creates a `GSource` that’s dispatched when `condition` is met for the given `channel`. For example, if condition is `G_IO_IN`, the source will be dispatched when there’s data available for reading.

The callback function invoked by the `GSource` should be added with g_source_set_callback(), but it has type `GIOFunc` (not `GSourceFunc`).

`g_io_add_watch()` is a simpler interface to this same functionality, for the case where you want to add the source to the default main loop context at the default priority.

On Windows, polling a `GSource` created to watch a channel for a socket puts the socket in non-blocking mode. This is a side-effect of the implementation and unavoidable.

#### Parameters

`channel`

  Type: `GIOChannel`

  A `GIOChannel` to watch.

  The data is owned by the caller of the function.

`condition`

  Type: `GIOCondition`

  Conditions to watch for.

#### Return value

Type: `GSource`

A new `GSource`.

The caller of the function takes ownership of the data, and is responsible for freeing it.