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
网友评论