1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 13:40:55 +00:00

add mutex

This commit is contained in:
astaxie 2013-06-26 22:16:03 +08:00
parent 573df2e747
commit 71adbdd7d7

View File

@ -29,9 +29,12 @@ type conn struct {
net.Conn
wg *sync.WaitGroup
isclose bool
lock sync.Mutex
}
func (c conn) Close() error {
c.lock.Lock()
defer c.lock.Unlock()
err := c.Conn.Close()
if !c.isclose {
c.wg.Done()