From 2db2d3220b1a167c99f08410a03574eef1a0c7c8 Mon Sep 17 00:00:00 2001 From: Tonghao Zhang Date: Thu, 22 Mar 2018 19:18:50 -0700 Subject: [PATCH] vhost: raise error on fdset-thread creation 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 --- 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 992c7aa1ca..5e24230c02 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -852,9 +852,11 @@ rte_vhost_driver_start(const char *path) 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) -- 2.20.1