make_pollfd


Description:

[ Version ( since = "2.22" ) ]
public bool make_pollfd (PollFD pollfd)

Creates a PollFD corresponding to this; this can be passed to poll and used to poll for cancellation.

This is useful both for unix systems without a native poll and for portability to windows.

When this function returns true, you should use release_fd to free up resources allocated for the pollfd. After a false return, do not call release_fd.

If this function returns false, either no this was given or resource limits prevent this function from allocating the necessary structures for polling. (On Linux, you will likely have reached the maximum number of file descriptors.) The suggested way to handle these cases is to ignore the this.

You are not supposed to read from the fd yourself, just check for readable status. Reading to unset the readable status is done with reset.

Parameters:

this

a Cancellable or null

pollfd

a pointer to a PollFD

Returns:

true if pollfd was successfully initialized, false on failure to prepare the cancellable.