Skip to content

Commit 65936b9

Browse files
committed
Revert "[NFC][LSAN] Limit the number of concurrent threads is the test"
This reverts commit 2a73b7b. This appears to be causing the following failures on GreenDragon: LeakSanitizer-AddressSanitizer-x86_64 :: TestCases/many_threads_detach.cpp LeakSanitizer-Standalone-x86_64 :: TestCases/many_threads_detach.cpp First failure: http://green.lab.llvm.org/green/job/clang-stage1-RA/20754/ Still failing in latest build: http://green.lab.llvm.org/green/job/clang-stage1-RA/20928/
1 parent 85e31ed commit 65936b9

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

compiler-rt/test/lsan/TestCases/many_threads_detach.cpp

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Use `-pthread` so that its driver will DTRT (ie., ignore it).
44
// RUN: %clangxx_lsan %s -o %t -pthread && %run %t
55

6-
#include <assert.h>
7-
#include <dirent.h>
86
#include <pthread.h>
97
#include <stdlib.h>
108
#include <unistd.h>
@@ -14,33 +12,15 @@
1412
// reused.
1513
static const size_t kTestThreads = 10000;
1614

17-
// Limit the number of simultaneous threads to avoid reaching the limit.
18-
static const size_t kTestThreadsBatch = 100;
19-
2015
void *null_func(void *args) {
2116
return NULL;
2217
}
2318

24-
int count_threads() {
25-
DIR *d = opendir("/proc/self/task");
26-
assert(d);
27-
int count = 0;
28-
while (readdir(d))
29-
++count;
30-
closedir(d);
31-
assert(count);
32-
return count;
33-
}
34-
3519
int main(void) {
36-
for (size_t i = 0; i < kTestThreads; i += kTestThreadsBatch) {
37-
for (size_t j = 0; j < kTestThreadsBatch; ++j) {
38-
pthread_t thread;
39-
assert(pthread_create(&thread, NULL, null_func, NULL) == 0);
20+
for (size_t i = 0; i < kTestThreads; i++) {
21+
pthread_t thread;
22+
if (pthread_create(&thread, NULL, null_func, NULL) == 0)
4023
pthread_detach(thread);
41-
}
42-
while (count_threads() > 10)
43-
sched_yield();
4424
}
4525
return 0;
4626
}

0 commit comments

Comments
 (0)