Gio.Socket.prototype.condition_timed_wait

function condition_timed_wait(condition: GLib.IOCondition, timeout: Number(gint64), cancellable: Gio.Cancellable): Boolean {
    // Gjs wrapper for g_socket_condition_timed_wait()
}
  

Waits for up to timeout 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 (or the socket's Gio.Socket.timeout) is reached before the condition is met, then false is returned and @error, if non-null, is set to the appropriate value (Gio.IOErrorEnum.cancelled or Gio.IOErrorEnum.timed_out).

If you don't want a timeout, use Gio.Socket.prototype.condition_wait. (Alternatively, you can pass -1 for timeout.)

Note that although timeout is in microseconds for consistency with other GLib APIs, this function actually only has millisecond resolution, and the behavior is undefined if timeout is not an exact number of milliseconds.

Since 2.32

condition

a GLib.IOCondition mask to wait for

timeout

the maximum time (in microseconds) to wait, or -1

cancellable

a Gio.Cancellable, or null

Returns

true if the condition was met, false otherwise