Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TSan] Increase the number of simultaneously locked mutexes that a thread can hold #116409

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class DeadlockDetectorTLS {
u32 lock;
u32 stk;
};
LockWithContext all_locks_with_contexts_[64];
LockWithContext all_locks_with_contexts_[128];
uptr n_all_locks_;
};

Expand Down
21 changes: 21 additions & 0 deletions compiler-rt/test/tsan/many_held_mutex.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -fsanitize=thread -o %t
// RUN: %run %t 128

#include <mutex>
#include <vector>
#include <string>

int main(int argc, char *argv[]) {
int num_of_mtx = std::atoi(argv[1]);

std::vector<std::mutex> mutexes(num_of_mtx);

for (auto& mu : mutexes) {
mu.lock();
}
for (auto& mu : mutexes) {
mu.unlock();
}

return 0;
}
Loading