### Virtual Method

# Gio DatagramBased condition_wait

since: 2.48

#### Declaration

    gboolean
    condition_wait (
      GDatagramBased* datagram_based,
      GIOCondition condition,
      gint64 timeout,
      GCancellable* cancellable,
      GError** error
    )

#### Description

Waits for up to `timeout` microseconds for condition to become true on `datagram_based`. If the condition is met, `TRUE` is returned.

If `cancellable` is cancelled before the condition is met, or if `timeout` is reached before the condition is met, then `FALSE` is returned and `error` is set appropriately (`G_IO_ERROR_CANCELLED` or `G_IO_ERROR_TIMED_OUT`).

Available since: 2.48

#### Parameters

`condition`

  Type: `GIOCondition`

  A `GIOCondition` mask to wait for.

`timeout`

  Type: `gint64`

  The maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`.

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

`error`

  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 be left initialized to `NULL` by the virtual function 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.