From: Tonghao Zhang <xiangxia.m....@gmail.com>

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....@gmail.com>
Reviewed-by: Jianfeng Tan <jianfeng....@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 8c98806..1352339 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -820,6 +820,7 @@ struct vhost_device_ops const *
 {
        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);
@@ -835,6 +836,14 @@ struct vhost_device_ops const *
                        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");
+                       }
                }
        }
 
-- 
1.8.3.1

Reply via email to