From: David Marchand <david.marchand@redhat.com>
To: "Min Hu (Connor)" <humin29@huawei.com>
Cc: dev <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
Ciara Power <ciara.power@intel.com>,
"Pattan, Reshma" <reshma.pattan@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 1/2] telemetry: fix missing check for thread creation
Date: Thu, 15 Apr 2021 16:55:46 +0200 [thread overview]
Message-ID: <CAJFAV8y_idFJcqUz=uCAm5AKYyN4HDkm6MNB5QoW_3=EjYssDQ@mail.gmail.com> (raw)
In-Reply-To: <1618487412-26678-2-git-send-email-humin29@huawei.com>
On Thu, Apr 15, 2021 at 1:50 PM Min Hu (Connor) <humin29@huawei.com> wrote:
> diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c
> index 7e08afd..e6a99f3 100644
> --- a/lib/librte_telemetry/telemetry.c
> +++ b/lib/librte_telemetry/telemetry.c
> @@ -350,6 +350,7 @@ socket_listener(void *socket)
> {
> while (1) {
> pthread_t th;
> + int rc;
> struct socket *s = (struct socket *)socket;
> int s_accepted = accept(s->sock, NULL, NULL);
> if (s_accepted < 0) {
> @@ -366,7 +367,12 @@ socket_listener(void *socket)
> __atomic_add_fetch(s->num_clients, 1,
> __ATOMIC_RELAXED);
> }
> - pthread_create(&th, NULL, s->fn, (void *)(uintptr_t)s_accepted);
> + rc = pthread_create(&th, NULL, s->fn, (void *)(uintptr_t)s_accepted);
> + if (rc != 0) {
> + TMTY_LOG(ERR, "Error with create client thread\n");
> + close(s_accepted);
> + return NULL;
> + }
Repeating my comment:
Either you use this rc variable (adding strerror(rc) in the log
message in TMTY_LOG()) or you remove the variable and simply test if
(pthread_create(...) != 0).
This comment applies to other changes in this patch.
And this applies to patch 2 too.
> pthread_detach(th);
> }
> return NULL;
Thanks.
--
David Marchand
next prev parent reply other threads:[~2021-04-15 14:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 10:44 [dpdk-dev] [PATCH 0/2] " Min Hu (Connor)
2021-04-10 10:44 ` [dpdk-dev] [PATCH 1/2] telemetry: " Min Hu (Connor)
2021-04-10 10:44 ` [dpdk-dev] [PATCH 2/2] test: " Min Hu (Connor)
2021-04-12 0:32 ` [dpdk-dev] [PATCH v2 0/2] " Min Hu (Connor)
2021-04-12 0:32 ` [dpdk-dev] [PATCH v2 1/2] telemetry: " Min Hu (Connor)
2021-04-12 7:48 ` David Marchand
2021-04-15 11:53 ` Min Hu (Connor)
2021-04-12 0:32 ` [dpdk-dev] [PATCH v2 2/2] test: " Min Hu (Connor)
2021-04-15 11:50 ` [dpdk-dev] [PATCH v3 0/2] " Min Hu (Connor)
2021-04-15 11:50 ` [dpdk-dev] [PATCH v3 1/2] telemetry: " Min Hu (Connor)
2021-04-15 14:55 ` David Marchand [this message]
2021-04-16 8:21 ` Min Hu (Connor)
2021-04-15 16:11 ` Power, Ciara
2021-04-16 8:19 ` Min Hu (Connor)
2021-04-15 11:50 ` [dpdk-dev] [PATCH v3 2/2] test: " Min Hu (Connor)
2021-04-15 17:05 ` Pattan, Reshma
2021-04-16 8:21 ` Min Hu (Connor)
2021-04-16 8:34 ` Ferruh Yigit
2021-04-16 9:16 ` Min Hu (Connor)
2021-04-16 8:18 ` [dpdk-dev] [PATCH v4 0/2] " Min Hu (Connor)
2021-04-16 8:18 ` [dpdk-dev] [PATCH v4 1/2] telemetry: " Min Hu (Connor)
2021-04-19 8:49 ` Power, Ciara
2021-04-16 8:18 ` [dpdk-dev] [PATCH v4 2/2] test: " Min Hu (Connor)
2021-04-19 9:33 ` Pattan, Reshma
2021-04-21 14:32 ` [dpdk-dev] [PATCH v4 0/2] " Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJFAV8y_idFJcqUz=uCAm5AKYyN4HDkm6MNB5QoW_3=EjYssDQ@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=humin29@huawei.com \
--cc=reshma.pattan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).