From mboxrd@z Thu Jan 1 00:00:00 1970 From: Huawei Xie Subject: [PATCH v4 4/4] vhost: add comment for potential unwanted callback on listenfds Date: Tue, 30 Jun 2015 17:20:50 +0800 Message-ID: <1435656050-3539-5-git-send-email-huawei.xie@intel.com> References: <1434649260-26317-2-git-send-email-huawei.xie@intel.com> <1435656050-3539-1-git-send-email-huawei.xie@intel.com> To: dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id ED192C438 for ; Tue, 30 Jun 2015 11:21:13 +0200 (CEST) In-Reply-To: <1435656050-3539-1-git-send-email-huawei.xie@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" add comment for potential unwanted callback on listenfds v4 changes: add comment for potential unwanted callback on listenfds Signed-off-by: Huawei Xie --- lib/librte_vhost/vhost_user/fd_man.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/librte_vhost/vhost_user/fd_man.c b/lib/librte_vhost/vhost_user/fd_man.c index bd30f8d..d68b270 100644 --- a/lib/librte_vhost/vhost_user/fd_man.c +++ b/lib/librte_vhost/vhost_user/fd_man.c @@ -242,6 +242,13 @@ fdset_event_dispatch(struct fdset *pfdset) pthread_mutex_unlock(&pfdset->fd_mutex); + /* + * When select is blocked, other threads might unregister + * listenfds from and register new listenfds into fdset. + * When select returns, the entries for listenfds in the fdset + * might have been updated. It is ok if there is unwanted call + * for new listenfds. + */ ret = select(maxfds + 1, &rfds, &wfds, NULL, &tv); if (ret <= 0) continue; -- 1.8.1.4