int
poll (struct pollfd *fds, nfds_t nfds, int timeout)
{
- ldp_worker_ctx_t *ldpw = ldp_worker_get_current ();
int rv, i, n_revents = 0;
+ ldp_worker_ctx_t *ldpw;
vls_handle_t vlsh;
vcl_poll_t *vp;
double max_time;
+ ldp_init_check ();
+
+ if (PREDICT_FALSE (vppcom_worker_index () == ~0))
+ vls_register_vcl_worker ();
+
+ ldpw = ldp_worker_get_current ();
+
LDBG (3, "fds %p, nfds %ld, timeout %d", fds, nfds, timeout);
if (PREDICT_FALSE (ldpw->clib_time.init_cpu_time == 0))
{
if (vec_len (ldpw->vcl_poll))
{
- rv = vppcom_poll (ldpw->vcl_poll, vec_len (ldpw->vcl_poll), 0);
+ rv = vls_poll (ldpw->vcl_poll, vec_len (ldpw->vcl_poll), 0);
if (rv < 0)
{
errno = -rv;
return rv;
}
+int
+vls_poll (vcl_poll_t *vp, uint32_t n_sids, double wait_for_time)
+{
+ int rv;
+ vcl_locked_session_t *vls = NULL;
+
+ vls_mt_detect ();
+ vls_mt_guard (vls, VLS_MT_OP_XPOLL);
+ rv = vppcom_poll (vp, n_sids, wait_for_time);
+ vls_mt_unguard ();
+ vls_handle_pending_wrk_cleanup ();
+ return rv;
+}
+
static void
vls_unshare_vcl_worker_sessions (vcl_worker_t * wrk)
{
int maxevents, double wait_for_time);
int vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
vcl_si_set * except_map, double wait_for_time);
+int vls_poll (vcl_poll_t *vp, uint32_t n_sids, double wait_for_time);
vcl_session_handle_t vlsh_to_sh (vls_handle_t vlsh);
vcl_session_handle_t vlsh_to_session_index (vls_handle_t vlsh);
int vlsh_to_worker_index (vls_handle_t vlsh);