diff --git a/compiler-rt/test/tsan/lots_of_threads.c b/compiler-rt/test/tsan/lots_of_threads.c --- a/compiler-rt/test/tsan/lots_of_threads.c +++ b/compiler-rt/test/tsan/lots_of_threads.c @@ -18,8 +18,13 @@ pthread_attr_setstacksize(&attr, 16 << 20); for (int iter = 0; iter < kIters; iter++) { pthread_t threads[kThreads]; - for (int t = 0; t < kThreads; t++) - pthread_create(&threads[t], &attr, thr, 0); + for (int t = 0; t < kThreads; t++) { + int err = pthread_create(&threads[t], &attr, thr, 0); + if (err) { + fprintf(stderr, "Failed to create thread #%d\n", t); + return 1; + } + } barrier_wait(&barrier); for (int t = 0; t < kThreads; t++) pthread_join(threads[t], 0);