qh_poll_until()

Updated: April 19, 2023

Call the specified poll check function at a specified interval

Synopsis:

#include <qh/time.h>
int qh_poll_until(uint64_t poll_interval_ns,
                  clockid_t clock_id,
                  uint64_t max_absolute_time_ns,
                  qh_poll_check_cb_ft poll_check_f,
                  void *cb_data)

Arguments:

poll_interval_ns
The amount of time (in nanoseconds) between the poll check calls.
clock_id
The ID of the clock to use for the operation.
max_absolute_time_ns
The maximum absolute time (in nanoseconds) at which polling should stop, based on the clock specified by clock_id.
poll_check_f
The poll function used to determine if polling should continue or not.
cb_data
The callback data provided to the cb_data parameter of poll_check_f.

Library:

qh

Description:

This function calls the poll check function specified by poll_check_f at intervals specified in nanoseconds by poll_interval_ns until either a maximum absolute time has been reached or the poll check function tells it to stop polling. Sleeping between the poll check calls and evaluating the maximum absolute time is done using the clock specified by clock_id.

Returns:

EOK, ETIME, or a standard errno on failure. errno is set if the return value is not EOK.

EOK
If the function slept for the amount of time specified by sleep_time_ns and has not reached the specified absolute time.
ETIME
If the time specified by max_absolute_time_ns has passed. The function may or may not have slept before returning.