DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jacek Piasecki <jacekx.piasecki@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, harry.van.haaren@intel.com,
	john.mcnamara@intel.com,
	Jacek Piasecki <jacekx.piasecki@intel.com>,
	ian.betts@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] examples/performance-thread: fix return check
Date: Thu, 12 Oct 2017 13:44:44 +0200	[thread overview]
Message-ID: <1507808684-37821-1-git-send-email-jacekx.piasecki@intel.com> (raw)

There was a call for thread create function without result check.
Added result check and message printout after failure.

Coverity issue: 143441
Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")
Cc: ian.betts@intel.com
Cc: stable@dpdk.org

Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
---
 examples/performance-thread/pthread_shim/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index 850b009..febae39 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -161,6 +161,7 @@ static void initial_lthread(void *args __attribute__((unused)))
 	pthread_override_set(1);
 
 	uint64_t i;
+	int ret;
 
 	/* initialize mutex for shared counter */
 	print_count = 0;
@@ -187,7 +188,10 @@ static void initial_lthread(void *args __attribute__((unused)))
 		pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t), &cpuset);
 
 		/* create the thread */
-		pthread_create(&tid[i], &attr, helloworld_pthread, (void *) i);
+		ret = pthread_create(&tid[i], &attr,
+				helloworld_pthread, (void *) i);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE, "Cannot create helloworld thread\n");
 	}
 
 	/* wait for 1s to allow threads
-- 
1.9.1

             reply	other threads:[~2017-10-12 11:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 11:44 Jacek Piasecki [this message]
2017-10-13 11:56 ` Jastrzebski, MichalX K
2017-10-13 23:07   ` [dpdk-dev] [dpdk-stable] " 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=1507808684-37821-1-git-send-email-jacekx.piasecki@intel.com \
    --to=jacekx.piasecki@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=ian.betts@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=stable@dpdk.org \
    /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).