condition_timed_wait


Description:

[ Version ( since = "2.32" ) ]
public bool condition_timed_wait (IOCondition condition, int64 timeout_us, Cancellable? cancellable = null) throws Error

Waits for up to timeout_us microseconds for condition to become true on this.

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 timeout) is reached before the condition is met, then false is returned and throws, 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 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.

Parameters:

this

a Socket

condition

a IOCondition mask to wait for

timeout_us

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

cancellable

a Cancellable, or null

Returns:

true if the condition was met, false otherwise