(the_bank: &Arc<Mutex<Bank>>, amt:f32)
| 1057 | use std::sync::{Arc, Mutex}; |
| 1058 | |
| 1059 | fn withdraw(the_bank: &Arc<Mutex<Bank>>, amt:f32){ |
| 1060 | let mut bank_ref = the_bank.lock().unwrap(); |
| 1061 | |
| 1062 | if bank_ref.balance < 5.00{ |
| 1063 | println!("Current Balance : {} Withdrawal a smaller amount", |
| 1064 | bank_ref.balance); |
| 1065 | } else { |
| 1066 | bank_ref.balance -= amt; |
| 1067 | println!("Customer withdrew {} Current Balance {}", |
| 1068 | amt, bank_ref.balance); |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | fn customer(the_bank: Arc<Mutex<Bank>>) { |
| 1073 | withdraw(&the_bank, 5.00); |