Skip to content

Commit 9062012

Browse files
gbMattNvitalybuka
authored andcommitted
[TSan] Increase the limit of simultaniously held mutexes TSan can keep track of from 64 to 128
1 parent 5fa0345 commit 9062012

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class DeadlockDetectorTLS {
120120
u32 lock;
121121
u32 stk;
122122
};
123-
LockWithContext all_locks_with_contexts_[64];
123+
LockWithContext all_locks_with_contexts_[128];
124124
uptr n_all_locks_;
125125
};
126126

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clangxx_tsan %s -fsanitize=thread -o %t && %run %t 2>&1 | Filecheck %s
2+
3+
#include <mutex>
4+
#include <stdio.h>
5+
6+
int main(){
7+
const unsigned short NUM_OF_MTX = 128;
8+
std::mutex mutexes[NUM_OF_MTX];
9+
10+
for(int i = 0; i < NUM_OF_MTX; i++){
11+
mutexes[i].lock();
12+
}
13+
for(int i = 0; i < NUM_OF_MTX; i++){
14+
mutexes[i].unlock();
15+
}
16+
17+
printf("Success\n");
18+
19+
return 0;
20+
}
21+
22+
// CHECK: Success
23+
// CHECK-NOT: ThreadSanitizer: CHECK failed

0 commit comments

Comments
 (0)