Go保证并发程序的数据安全性

并发安全

1.使用chan

2.使用原子性函数atomic函数

3.使用互斥锁sync.mutex

4.使用等待组sync.waitgroup

5.使用context系列函数超时退出