g_unix_fd_add (
  gint fd,
  GIOCondition condition,
  GUnixFDSourceFunc function,
  gpointer user_data


Sets a function to be called when the IO condition, as specified by condition becomes true for fd.

function will be called when the specified IO condition becomes TRUE. The function is expected to clear whatever event caused the IO condition to become true and return TRUE in order to be notified when it happens again. If function returns FALSE then the watch will be cancelled.

The return value of this function can be passed to g_source_remove() to cancel the watch at any time that it exists.

The source will never close the fd — you must do it yourself.

Available since:2.36


fd gint

A file descriptor.

condition GIOCondition

IO conditions to watch for on fd.

function GUnixFDSourceFunc

A GUnixFDSourceFunc.

user_data gpointer

Data to pass to function.

 The argument can be NULL.

Return value

Returns: guint

The ID (greater than 0) of the event source.