linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: Clark Williams <williams@redhat.com>
Subject: signaltest: Check the status of pthread_create
Date: Mon, 5 Oct 2015 16:05:48 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1510051603350.14006@riemann> (raw)

>From 57ea5d7d17b4e8aea36576e91c02082511a5db87 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Wed, 30 Sep 2015 23:09:41 +0200
Subject: [PATCH] signaltest: Check the status of pthread_create

Check the status of pthread_create to help debug signaltest

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/signaltest/signaltest.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 791df0e492f9..2ee1929f135b 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -27,6 +27,7 @@
 #include <sys/time.h>
 #include <sys/mman.h>
 
+#include "error.h"
 #include "rt-utils.h"
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -316,6 +317,7 @@ int main(int argc, char **argv)
 	struct thread_param *par;
 	struct thread_stat *stat;
 	int i, ret = -1;
+	int status;
 
 	process_options(argc, argv);
 
@@ -366,7 +368,11 @@ int main(int argc, char **argv)
 		stat[i].max = -1000000;
 		stat[i].avg = 0.0;
 		stat[i].threadstarted = 1;
-		pthread_create(&stat[i].thread, NULL, signalthread, &par[i]);
+		status = pthread_create(&stat[i].thread, NULL, signalthread,
+					&par[i]);
+		if (status)
+			fatal("failed to create thread %d: %s\n", i,
+			      strerror(status));
 	}
 
 	while (!shutdown) {
-- 
2.4.3


                 reply	other threads:[~2015-10-05 14:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.LFD.2.20.1510051603350.14006@riemann \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.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).