死锁产生条件:互斥,占有并等待,不可抢占,循环等待
type Account struct {
Id string
Balance float64
lock sync.Mutex
}
func (a *Account) deposit(amount float64){
a.Balance += amount
}
func (a *Account) withdrew(amount float64){
a.Balance -= amount
}
func main(){
wg := sync.WaitGroup{
}
wg.Add(2)
a := Account