forked from OSchip/llvm-project
[TSan] Make test fail more predictably
This test would hang when the system ran out of resources and we fail to create all 300 threads. Differential Revision: https://reviews.llvm.org/D115845
This commit is contained in:
parent
2d0bf14397
commit
3a1eb1cf2a
|
@ -18,8 +18,13 @@ int main() {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue