Skip to content

Instantly share code, notes, and snippets.

@1502shivam-singh
Created May 8, 2021 21:02
Show Gist options
  • Save 1502shivam-singh/44d6c778d8c997b99e0b0fdb900a6cee to your computer and use it in GitHub Desktop.
Save 1502shivam-singh/44d6c778d8c997b99e0b0fdb900a6cee to your computer and use it in GitHub Desktop.
The most basic deadlock example (recursive)
#include <iostream>
#include <mutex>
std::mutex mtx;
void deadlock() {
std::lock_guard<std::mutex> _mu(mtx);
std::cout<<"Deadlock incoming\n";
deadlock();
}
int main(){
deadlock();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment