You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
282 B
Rust

use std::thread;
use std::sync::{Arc};
fn main() {
let a = Arc::new(vec![1, 2, 3]);
{
let a = Arc::clone(&a);
thread::spawn(move || {
a[1];
});
}
{
let a = Arc::clone(&a);
thread::spawn(move || {
a[1];
});
}
}