Skip to content

Instantly share code, notes, and snippets.

View PODiPiT's full-sized avatar

Alexandr Nikitin PODiPiT

  • Toronto, Canada
View GitHub Profile
@wuct
wuct / deadlock.rs
Created June 29, 2020 11:49
A deadlock example in Rust with threads and `Mutex`
use std::sync::{Arc, Mutex};
use std::thread;
fn main() {
let a = Arc::new(Mutex::new(0));
let b = Arc::new(Mutex::new(0));
let mut handles = vec![];
{
let a = Arc::clone(&a);