1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:24:41 -07:00

net: fix bug in fdMutex

Fixes #6165.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12984044
This commit is contained in:
Dmitriy Vyukov 2013-08-16 16:02:55 +04:00
parent b6a8fa100c
commit 727dd08cdf

View File

@ -98,7 +98,7 @@ func (mu *fdMutex) Decref() bool {
}
new := old - mutexRef
if atomic.CompareAndSwapUint64(&mu.state, old, new) {
return new&(mutexClosed|mutexRef) == mutexClosed
return new&(mutexClosed|mutexRefMask) == mutexClosed
}
}
}
@ -174,7 +174,7 @@ func (mu *fdMutex) RWUnlock(read bool) bool {
if old&mutexMask != 0 {
runtime_Semrelease(mutexSema)
}
return new&(mutexClosed|mutexRef) == mutexClosed
return new&(mutexClosed|mutexRefMask) == mutexClosed
}
}
}