深入源码分析golang之sync.WaitGroup - no
2023-02-15 本文已影响0人
robertzhai
image.png
WaitGroup对外提供三个接口:
-
Add(delta int): 将delta值加到counter中
-
Wait(): waiter递增1,并阻塞等待信号量semaphore
-
Done(): counter递减1,按照waiter数值释放相应次数信号量
-
https://www.bookstack.cn/read/GoExpertProgramming/chapter05-5.2-waitgroup.md
-
https://blog.csdn.net/CharlesJhonson/article/details/104862665