noPollConn* nopoll_ctx_foreach_conn ( noPollCtx ctx,
noPollForeachConn  foreach,
noPollPtr  user_data 
)

Allows to iterate over all connections currently registered on the provided context, optionally stopping the foreach process, returning the connection reference selected if the foreach handler returns nopoll_true.

Parameters
ctxThe nopoll context where the foreach operation will take place.
foreachThe foreach handler to be called for each connection registered.
user_dataAn optional reference to a pointer that will be passed to the handler.
Returns
Returns the connection selected (in the case the foreach function returns nopoll_false) or NULL in the case all foreach executions returned nopoll_true. Keep in mind the function also returns NULL if ctx or foreach parameter is NULL.

See noPollForeachConn for a signature example.

References nopoll_mutex_lock(), nopoll_mutex_unlock(), and nopoll_return_val_if_fail.

Referenced by nopoll_loop_wait().