Files
Whitecat18 28e7fac1d3 Upload
Rust-for-Malware-Development is an collection of proof of concepts with techniques and advanced evasion methods
2026-06-06 14:53:10 +05:30

26 lines
522 B
Rust

// Pointer concept to understand
fn main(){
let number = Arc::new(Mutex::new(0));
let my_number = Arc::clone(&number);
let my_number2 = Arc::clone(&number);
let thread1 = std::thread::spawn(move||{
for _ in 0..10{
*my_number.lock().unwrap() += 1;
}
});
let thread2 = std::thread::spawn(move ||{
for _ in 0..10{
*my_number2.lock().unwrap() += 1;
}
});
thread1.join().unwrap();
thread2.join().unwrap();
println!("Value is : {:?}",number);
println!("(+) Exiting...");
}