[sheepdog] [PATCH v2] lib/sheep: handle multi-requests in one eventfd_read

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed May 27 08:22:42 CEST 2015


At Wed, 27 May 2015 13:56:04 +0800,
Yu Yang wrote:
> 
> From: Yu Yang <yuyang at cmss.chinamobile.com>
> 
> When there are more than one request in eventfd, we
> need to handle them one by one.
> 
> Signed-off-by: Yu Yang <yuyang at cmss.chinamobile.com>
> ---
>  lib/shared/sheep.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Applied, thanks.
Hitoshi

> 
> 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
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog


More information about the sheepdog mailing list