From mboxrd@z Thu Jan 1 00:00:00 1970 From: xiangxia.m.yue@gmail.com Subject: [PATCH v2 1/2] vhost: make sure vhost fdset-thread created successfully Date: Thu, 22 Mar 2018 19:18:50 -0700 Message-ID: <1521771531-95836-1-git-send-email-xiangxia.m.yue@gmail.com> Cc: dev@dpdk.org, Tonghao Zhang To: jianfeng.tan@intel.com Return-path: Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by dpdk.org (Postfix) with ESMTP id 65B6B2B9C for ; Fri, 23 Mar 2018 03:19:06 +0100 (CET) Received: by mail-pf0-f195.google.com with SMTP id y186so4171080pfb.2 for ; Thu, 22 Mar 2018 19:19:06 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Tonghao Zhang When first call the 'rte_vhost_driver_start', the fdset_event_dispatch thread should be created successfully. Because the vhost uses it to poll socket events for vhost server or clients. Without it, for example, vhost will not get the connection event. This patch returns err code directly when created not successful. Signed-off-by: Tonghao Zhang Reviewed-by: Jianfeng Tan --- v2: According to rte_vhost_driver_start doc, replace the err code of pthread_create with -1. --- lib/librte_vhost/socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 83befdc..8c98806 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -831,9 +831,11 @@ struct vhost_device_ops const * if (fdset_tid == 0) { int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch, &vhost_user.fdset); - if (ret != 0) + if (ret != 0) { RTE_LOG(ERR, VHOST_CONFIG, "failed to create fdset handling thread"); + return -1; + } } if (vsocket->is_server) -- 1.8.3.1