summaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-03-01 00:45:31 -0800
committerDave Wallace <dwallacelf@gmail.com>2023-03-01 19:28:06 +0000
commit7a1e95a3178943c8a3d2fe7f812f4710b13f7f4d (patch)
tree1dd7dcdf5d566a53108541a6261542e5767a1896 /src/vcl/ldp.c
parent06defbc5de0d36f5d2a1d686d5d7d24c7c8476cd (diff)
vcl: accept vcl spurious wakeup in epoll wait eventfd
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
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r--src/vcl/ldp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 3d4c01c7833..9e01ac95bec 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -2567,7 +2567,7 @@ ldp_epoll_pwait_eventfd (int epfd, struct epoll_event *events,
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 ();
@@ -2651,6 +2651,7 @@ ldp_epoll_pwait_eventfd (int epfd, struct epoll_event *events,
goto done;
}
+epoll_again:
rv = libc_epoll_pwait (libc_epfd, events, maxevents, timeout, sigmask);
if (rv <= 0)
goto done;
@@ -2668,6 +2669,9 @@ ldp_epoll_pwait_eventfd (int epfd, struct epoll_event *events,
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;
break;
}
}