linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* signaltest: Check the status of pthread_create
@ 2015-10-05 14:05 John Kacur
  0 siblings, 0 replies; only message in thread
From: John Kacur @ 2015-10-05 14:05 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams

>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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-05 14:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 14:05 signaltest: Check the status of pthread_create John Kacur

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).