We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
$ clang -v Ubuntu clang version 15.0.7 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11 Candidate multilib: .;@m64 Selected multilib: .;@m64
// not deadlock, but report potential deadlock void notDeadlockButReport() { std::mutex m1; std::mutex m2; // m1 => m2 std::cout << "t try to acquire m1\n"; m1.lock(); std::cout << "t got m1\n"; //std::this_thread::sleep_for(std::chrono::microseconds (2)); // wait main got m2 // code never executed std::cout << "t try to acquire m2\n"; m2.lock(); std::cout << "t got m2\n"; m2.unlock(); m1.unlock(); // m2 => m1 std::cout << "main try to acquire m2\n"; m2.lock(); std::cout << "main got m2\n"; // code never executed std::cout << "main try to acquire m1\n"; m1.lock(); std::cout << "main got m1\n"; m1.unlock(); m2.unlock(); }
void deadlockButNotReport() { std::mutex m1; std::mutex m2; std::thread t([&] { std::cout << "t try to acquire m1\n"; m1.lock(); std::cout << "t got m1\n"; std::this_thread::sleep_for(std::chrono::milliseconds (20)); // wait main got m2 std::cout << "t try to acquire m2\n"; m2.lock(); std::cout << "t got m2\n"; // code never executed m2.unlock(); m1.unlock(); }); std::this_thread::sleep_for(std::chrono::milliseconds(10)); // wait t got m1 std::cout << "main try to acquire m2\n"; m2.lock(); std::cout << "main got m2\n"; std::cout << "main try to acquire m1\n"; m1.lock(); std::cout << "main got m1\n"; // code never executed m1.unlock(); m2.unlock(); t.join(); }
The text was updated successfully, but these errors were encountered:
Could you please try 16 or main branch?
main
Sorry, something went wrong.
@EugeneZelenko I tried with clang-16, the result turn out the same with clang-15
No branches or pull requests
Env
Description
The text was updated successfully, but these errors were encountered: