mirror of
https://codeberg.org/smukx/Rust-for-Malware-Development
synced 2026-06-06 20:22:59 +00:00
28e7fac1d3
Rust-for-Malware-Development is an collection of proof of concepts with techniques and advanced evasion methods
26 lines
522 B
Rust
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...");
|
|
}
|