Method
GioSocketcondition_timed_wait
since: 2.32
Declaration
gboolean
g_socket_condition_timed_wait (
GSocket* socket,
GIOCondition condition,
gint64 timeout_us,
GCancellable* cancellable,
GError** error
)
Description
Waits for up to timeout_us microseconds for condition to become true
on socket. If the condition is met, TRUE is returned.
If cancellable is cancelled before the condition is met, or if
timeout_us (or the socket’s GSocket:timeout) 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).
If you don’t want a timeout, use g_socket_condition_wait().
(Alternatively, you can pass -1 for timeout_us.)
Note that although timeout_us is in microseconds for consistency with
other GLib APIs, this function actually only has millisecond
resolution, and the behavior is undefined if timeout_us is not an
exact number of milliseconds.
Available since: 2.32
Parameters
condition-
Type:
GIOConditionA
GIOConditionmask to wait for. timeout_us-
Type:
gint64The maximum time (in microseconds) to wait, or -1.
cancellable-
Type:
GCancellableA
GCancellable, orNULL.The argument can be NULL.The data is owned by the caller of the method. 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 aNULLGError*.The argument will be left initialized to NULLby 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.