MCPcopy Create free account
hub / github.com/CodeSentryAI/lockbud / two_closures

Function two_closures

toys/lock-closure/src/main.rs:20–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18}
19
20fn two_closures() {
21 let lock_a1 = Arc::new(Mutex::new(1));
22 let lock_a2 = lock_a1.clone();
23 let lock_b1 = Arc::new(Mutex::new(true));
24 let lock_b2 = lock_b1.clone();
25 let th1 = thread::spawn(move || {
26 let _b = lock_b1.lock().unwrap();
27 let _a = lock_a1.lock().unwrap();
28 });
29 let th2 = thread::spawn(move || {
30 let _a = lock_a2.lock().unwrap();
31 let _b = lock_b2.lock().unwrap();
32 });
33 th1.join().unwrap();
34 th2.join().unwrap();
35}
36
37fn main() {
38 one_closure_one_caller();

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected