From ce5bd5fcae432c63bfe777d9c509e2cb2f1fce1a Mon Sep 17 00:00:00 2001
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Thu, 22 Mar 2018 19:18:51 -0700
Subject: [PATCH] vhost: add fdset-event thread name

This patch adds the name for vhost fdset thread.
It can help us to know whether the thread is running.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 lib/librte_vhost/socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 5e24230c02..8bc8228bba 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -841,6 +841,7 @@ rte_vhost_driver_start(const char *path)
 {
 	struct vhost_user_socket *vsocket;
 	static pthread_t fdset_tid;
+	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
 	pthread_mutex_lock(&vhost_user.mutex);
 	vsocket = find_vhost_user_socket(path);
@@ -856,6 +857,14 @@ rte_vhost_driver_start(const char *path)
 			RTE_LOG(ERR, VHOST_CONFIG,
 				"failed to create fdset handling thread");
 			return -1;
+		} else {
+			snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+				 "vhost-events");
+
+			if (rte_thread_setname(fdset_tid, thread_name)) {
+				RTE_LOG(DEBUG, VHOST_CONFIG,
+					"failed to set vhost-event thread name");
+			}
 		}
 	}
 
-- 
2.39.5