| 1 | // RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -fsanitize=thread -o %t |
|---|---|
| 2 | // RUN: %run %t 128 |
| 3 | |
| 4 | #include <mutex> |
| 5 | #include <string> |
| 6 | #include <vector> |
| 7 | |
| 8 | int main(int argc, char *argv[]) { |
| 9 | int num_of_mtx = std::atoi(argv[1]); |
| 10 | |
| 11 | std::vector<std::mutex> mutexes(num_of_mtx); |
| 12 | |
| 13 | for (auto &mu : mutexes) { |
| 14 | mu.lock(); |
| 15 | } |
| 16 | for (auto &mu : mutexes) { |
| 17 | mu.unlock(); |
| 18 | } |
| 19 | |
| 20 | return 0; |
| 21 | } |
| 22 |
