Commit 727dd08c authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

net: fix bug in fdMutex

Fixes #6165.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12984044
parent b6a8fa10
...@@ -98,7 +98,7 @@ func (mu *fdMutex) Decref() bool { ...@@ -98,7 +98,7 @@ func (mu *fdMutex) Decref() bool {
} }
new := old - mutexRef new := old - mutexRef
if atomic.CompareAndSwapUint64(&mu.state, old, new) { 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 { ...@@ -174,7 +174,7 @@ func (mu *fdMutex) RWUnlock(read bool) bool {
if old&mutexMask != 0 { if old&mutexMask != 0 {
runtime_Semrelease(mutexSema) runtime_Semrelease(mutexSema)
} }
return new&(mutexClosed|mutexRef) == mutexClosed return new&(mutexClosed|mutexRefMask) == mutexClosed
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment