From: Dmitriy Vyukov Date: Fri, 16 Aug 2013 12:02:55 +0000 (+0400) Subject: net: fix bug in fdMutex X-Git-Tag: go1.2rc2~522 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=727dd08cdf80081bcd3ba0921104cce8474d9881;p=gostls13.git net: fix bug in fdMutex Fixes #6165. R=golang-dev, r CC=golang-dev https://golang.org/cl/12984044 --- diff --git a/src/pkg/net/fd_mutex.go b/src/pkg/net/fd_mutex.go index 1caf974dd1..6d5509d7f2 100644 --- a/src/pkg/net/fd_mutex.go +++ b/src/pkg/net/fd_mutex.go @@ -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 } } }