since: 2.22


g_socket_condition_wait (
  GSocket* socket,
  GIOCondition condition,
  GCancellable* cancellable,
  GError** error


Waits for condition to become true on socket. When the condition is met, TRUE is returned.

If cancellable is cancelled before the condition is met, or if the socket has a timeout set and it is reached before the condition is met, then FALSE is returned and error, if non-NULL, is set to the appropriate value (G_IO_ERROR_CANCELLED or G_IO_ERROR_TIMED_OUT).

See also g_socket_condition_timed_wait().

Available since: 2.22



Type: GIOCondition

A GIOCondition mask to wait for.


Type: GCancellable

A GCancellable, or NULL.

The argument can be NULL.
The data is owned by the caller of the function.

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if the condition was met, FALSE otherwise.