Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我发现了一个无关紧要的问题 #1

Closed
hellojukay opened this issue Apr 14, 2018 · 1 comment
Closed

我发现了一个无关紧要的问题 #1

hellojukay opened this issue Apr 14, 2018 · 1 comment

Comments

@hellojukay
Copy link

hellojukay commented Apr 14, 2018

pmon/pmon.go

Line 76 in c7d959a

complete <- 1

这行代码似乎永远也不会执行,所以是不是可以删除

pmon/pmon.go

Line 33 in c7d959a

for i := 0; i < processCount; i++ {

这个也是在循环的第一次的时候就阻塞了,然后程序就永远都不会退出(这是你们的目的)

@tabalt
Copy link
Owner

tabalt commented Apr 14, 2018

这两处代码是配合使用的,目的是当所有的协程都退出后主程序才退出,算是一个常用实践。
从目前monitorProcess函数的逻辑代码表面看,确实不会出现协程退出的情况,但是后续有可能会添加异常退出的代码,因此这两处逻辑不可以删除。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants