the function failed. This helps on systems which don't
have lots of memory.
Suggested by Christian Borntraeger.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11967
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
/*********************/
t[i].b = &b;
t[i].array = array;
t[i].iterations = iterations;
- pthread_create(&t[i].tid, 0, (void*(*)(void*))threadfunc, &t[i]);
+ if (pthread_create(&t[i].tid, 0, (void*(*)(void*))threadfunc, &t[i])) {
+ fprintf(stderr, "Could not create thread #%d (of %d): %s\n",
+ i, nthread, strerror(errno));
+ exit(1);
+ }
}
for (i = 0; i < nthread; i++)