We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
请问下 pool 为什么每次要 lock ,是什么考虑呢
// getConns 获取所有连接 func (c *channelPool) getConns() chan *idleConn { c.mu.Lock() conns := c.conns c.mu.Unlock()
The text was updated successfully, but these errors were encountered:
考虑并发的时候,获取链接的时候冲突,所以要把这个地方锁住,等拿出来了。再释放。掉锁
Sorry, something went wrong.
conns本身就是chan,没有必要再加读锁吧
No branches or pull requests
请问下 pool 为什么每次要 lock ,是什么考虑呢
// getConns 获取所有连接
func (c *channelPool) getConns() chan *idleConn {
c.mu.Lock()
conns := c.conns
c.mu.Unlock()
The text was updated successfully, but these errors were encountered: