vhost: add reconnect thread name for client mode
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Fri, 5 Jan 2018 14:10:39 +0000 (06:10 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
This patch adds the name for vhost-user reconnect thread.
It can help us to know whether the thread is running.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
lib/librte_vhost/socket.c

index d44a0f1..a71e271 100644 (file)
@@ -433,6 +433,7 @@ static int
 vhost_user_reconnect_init(void)
 {
        int ret;
+       char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
        ret = pthread_mutex_init(&reconn_list.mutex, NULL);
        if (ret < 0) {
@@ -449,6 +450,14 @@ vhost_user_reconnect_init(void)
                        RTE_LOG(ERR, VHOST_CONFIG,
                                "failed to destroy reconnect mutex");
                }
+       } else {
+               snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+                        "vhost-reconn");
+
+               if (rte_thread_setname(reconn_tid, thread_name)) {
+                       RTE_LOG(DEBUG, VHOST_CONFIG,
+                               "failed to set reconnect thread name");
+               }
        }
 
        return ret;