From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5247CA0C47;
	Thu, 19 Aug 2021 04:38:26 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C325C4067E;
	Thu, 19 Aug 2021 04:38:25 +0200 (CEST)
Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com
 [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id 83A9C40141
 for <dev@dpdk.org>; Thu, 19 Aug 2021 04:38:23 +0200 (CEST)
Received: by mail-pj1-f42.google.com with SMTP id
 m24-20020a17090a7f98b0290178b1a81700so3738021pjl.4
 for <dev@dpdk.org>; Wed, 18 Aug 2021 19:38:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=A5nnFX3nMTjxG7Ou+3mvDLrdcvKp7hVv75uF9toqZAY=;
 b=YfoxB0IgCG70bITvR/Nd/SY2/Y/OB3o89x+6k4DHbMfZDwbjUN9gcI0gHyAUA8qhis
 kS3PnAYXKE+h1FfFNGwLLNG+TBVKx9Cs8RJEtY/zEjVW4LByZPxW0PRx4ibXpAYegy8X
 8xis8NIdalCckbdhqnc5CA8EeUpB/Bu+Ysi9qiqmy6uPjGlWKVPgz3rSY7kAasjFe1Ic
 rW3ufOby6H46fi1m6ga7xtFyhanPnMbBNCySzd9B18MO/XwGz5t6X9kSw1clFh0dTUOy
 K46b5r56BVViEqXC0clGjxgh742u+2YDtzoYiiUz5CJu/rznQi079JEmmN4NQ/wy2l/D
 uOFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=A5nnFX3nMTjxG7Ou+3mvDLrdcvKp7hVv75uF9toqZAY=;
 b=bHhLzftkukfqvszb3Ks5PmAncDekheudRGFrim95XQ8B1AS9v0I0EKHV3pgzpQXB5F
 stPwB49hUcO+LTF7tAIVhBD5bvqfXT2T/Nb1k3Aa3w1JB7r3xi3rdlAqS1Wg5CE7K18b
 BVGEwTdYYbgQziDpz8RkyfNat9Dk8X+mW+rXAAKPII/KUt6CUEkVGL3gJ/T4YZROlWVx
 xlSMCe2ELPFlRw4WvhlEWRNqGM78cmbStAatqWSxd2+f+9LanoAw/cj5LNzfqThHArlg
 uFfEba14wyeoxVzlVGiJmvbJItLQjyA0y4kzGPhl31WFbCW+c1D/3hvrJ71oHEWAryn3
 WmTw==
X-Gm-Message-State: AOAM5324iis2c2qQniA2jvNaL5dTT2BhbMIlHCokmxLVfDW0QODOPcvP
 F51z0agNy5qJwBiCzsD4g3kg9A==
X-Google-Smtp-Source: ABdhPJxdJ1ycf6SjQ/C6uhR/kzCrYbDwNDZwTZlDTmZLx6uuy2N8n1GZ1JyZtlW3yB9iGNg23qSKqg==
X-Received: by 2002:a17:90a:db44:: with SMTP id
 u4mr12490938pjx.180.1629340702748; 
 Wed, 18 Aug 2021 19:38:22 -0700 (PDT)
Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123])
 by smtp.gmail.com with ESMTPSA id z3sm1157464pff.47.2021.08.18.19.38.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 18 Aug 2021 19:38:22 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: ciara.power@intel.com
Cc: dev@dpdk.org,
	Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 18 Aug 2021 19:38:19 -0700
Message-Id: <20210819023819.1709957-1-stephen@networkplumber.org>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH] telemetry: detach pthreads
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

There are a number telemetry threads which are created and
there is nothing that does pthread_join() to wait for them.
Mark these threads as detached, so that the pthread library
can cleanup state when the thread exits.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/telemetry/telemetry.c        | 2 ++
 lib/telemetry/telemetry_legacy.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 8665db8d035b..976f0a21566e 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -490,6 +490,7 @@ telemetry_legacy_init(void)
 	pthread_setaffinity_np(t_old, sizeof(*thread_cpuset), thread_cpuset);
 	set_thread_name(t_old, "telemetry-v1");
 	TMTY_LOG(DEBUG, "Legacy telemetry socket initialized ok\n");
+	pthread_detach(t_old);
 	return 0;
 }
 
@@ -528,6 +529,7 @@ telemetry_v2_init(void)
 	}
 	pthread_setaffinity_np(t_new, sizeof(*thread_cpuset), thread_cpuset);
 	set_thread_name(t_new, "telemetry-v2");
+	pthread_detach(t_new);
 	atexit(unlink_sockets);
 
 	return 0;
diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
index b7cd1bdd6c7b..8aba44d689b7 100644
--- a/lib/telemetry/telemetry_legacy.c
+++ b/lib/telemetry/telemetry_legacy.c
@@ -121,6 +121,7 @@ register_client(const char *cmd __rte_unused, const char *params,
 		close(fd);
 		return -1;
 	}
+	pthread_detach(th);
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 	return 0;
 }
-- 
2.30.2