22 lines · cpp
1// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -fsanitize=thread -o %t2// RUN: %run %t 1283 4#include <mutex>5#include <string>6#include <vector>7 8int 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