Accept one spurious wakeup from vcl in epoll_pwait_eventfd to avoid
returning zero events to app without timeout.
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I447c7f8176413c562be28605376a92d15e22a1f9
int maxevents, int timeout, const sigset_t * sigmask)
{
ldp_worker_ctx_t *ldpw;
int maxevents, int timeout, const sigset_t * sigmask)
{
ldp_worker_ctx_t *ldpw;
- int libc_epfd, rv = 0, num_ev;
+ int libc_epfd, rv = 0, num_ev, vcl_wups = 0;
vls_handle_t ep_vlsh;
ldp_init_check ();
vls_handle_t ep_vlsh;
ldp_init_check ();
rv = libc_epoll_pwait (libc_epfd, events, maxevents, timeout, sigmask);
if (rv <= 0)
goto done;
rv = libc_epoll_pwait (libc_epfd, events, maxevents, timeout, sigmask);
if (rv <= 0)
goto done;
num_ev = vls_epoll_wait (ep_vlsh, &events[rv], maxevents - rv, 0);
if (PREDICT_TRUE (num_ev > 0))
rv += num_ev;
num_ev = vls_epoll_wait (ep_vlsh, &events[rv], maxevents - rv, 0);
if (PREDICT_TRUE (num_ev > 0))
rv += num_ev;
+ /* Woken up by vcl but no events generated. Accept it once */
+ if (rv == 0 && vcl_wups++ < 1)
+ goto epoll_again;