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

[suggest] struct or args majorization #1

Open
ywanbing opened this issue Apr 22, 2021 · 1 comment
Open

[suggest] struct or args majorization #1

ywanbing opened this issue Apr 22, 2021 · 1 comment

Comments

@ywanbing
Copy link

g2cache/grpool.go

Lines 89 to 100 in 0098a51

jobQueue := make(chan Job, jobQueueLen)
pool := &Pool{
JobQueue: jobQueue,
workers: make([]*worker, numWorkers),
stopped: make(chan struct{}),
}
for i := 0; i < numWorkers; i++ {
pool.wg.Add(1)
pool.workers[i] = newWorker(int64(i), pool, jobQueue)
}

对于 pool 对象,他本身存在 jobQueue chan. 可以去掉jobQueue 变量。
在 newWorker(int64(i), pool, jobQueue) 里面,可以从pool 中取出 jobQueue 变量。

@kelvins-io
Copy link
Owner

新版本已经去掉

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