From: Yu Yang <[email protected]> When there are more than one request in eventfd, we need to handle them one by one.
Signed-off-by: Yu Yang <[email protected]> --- lib/shared/sheep.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/shared/sheep.c b/lib/shared/sheep.c index 933be07..69b99dd 100644 --- a/lib/shared/sheep.c +++ b/lib/shared/sheep.c @@ -478,7 +478,9 @@ static void *reply_handler(void *data) !list_empty(&c->inflight_list)) { bool empty; - eventfd_xread(c->reply_fd); + uint64_t events; + events = eventfd_xread(c->reply_fd); + sd_read_lock(&c->inflight_lock); empty = list_empty(&c->inflight_list); sd_rw_unlock(&c->inflight_lock); @@ -486,7 +488,8 @@ static void *reply_handler(void *data) if (empty) continue; - sheep_handle_reply(c); + for (uint64_t i = 0; i < events; i++) + sheep_handle_reply(c); } pthread_detach(pthread_self()); -- 1.7.9.5 -- sheepdog mailing list [email protected] https://lists.wpkg.org/mailman/listinfo/sheepdog
