condition_check


Description:

public IOCondition condition_check (IOCondition condition)

Checks on the readiness of this to perform operations.

The operations specified in condition are checked for and masked against the currently-satisfied conditions on this. The result is returned.

g_io_in will be set in the return value if data is available to read with receive_messages, or if the connection is closed remotely (EOS); and if the datagram_based has not been closed locally using some implementation-specific method (such as close or shutdown with shutdown_read set, if it’s a Socket).

If the connection is shut down or closed (by calling close or shutdown with shutdown_read set, if it’s a Socket, for example), all calls to this function will return g_io_error_closed.

g_io_out will be set if it is expected that at least one byte can be sent using send_messages without blocking. It will not be set if the datagram_based has been closed locally.

g_io_hup will be set if the connection has been closed locally.

g_io_err will be set if there was an asynchronous error in transmitting data previously enqueued using send_messages.

Note that on Windows, it is possible for an operation to return g_io_error_would_block even immediately after condition_check has claimed that the DatagramBased is ready for writing. Rather than calling condition_check and then writing to the DatagramBased if it succeeds, it is generally better to simply try writing right away, and try again later if the initial attempt returns g_io_error_would_block.

It is meaningless to specify g_io_err or g_io_hup in condition ; these conditions will always be set in the output if they are true. Apart from these flags, the output is guaranteed to be masked by condition.

This call never blocks.

Parameters:

this

a DatagramBased

condition

a IOCondition mask to check

Returns:

the IOCondition mask of the current state




2022 vala-language.org