Function anjay_serve_any

Function Documentation

int anjay_serve_any(anjay_t *anjay, avs_time_duration_t max_wait_time)

Executes select() or poll() on all sockets currently in use and calls anjay_serve if appropriate.

This is intended as a building block for custom event loops. In particular, this code:

while (true) { anjay_serve_any(anjay, max_wait_time); anjay_sched_run(anjay); }

is equivalent to anjay_event_loop_run(anjay, max_wait_time), as long as anjay_event_loop_interrupt is never called.

CAUTION: Most of the caveats described in the documentation for anjay_event_loop_run also apply to this function. Please refer there for more information.

Parameters:
  • anjay – Anjay object to operate on.

  • max_wait_time – Maximum time to spend in poll() or select().

Returns:

0 for success, or a negative value in case of a fatal error. Please note that errors from anjay_serve are not considered fatal.