sync.RWMutex: Teach it to downgrade from write-locked into read-locked state
Go version does not provide this, but the topic of sync.RWMutex downgrading was raised up several times, at least https://github.com/golang/go/issues/4026 https://github.com/golang/go/issues/23513 https://groups.google.com/forum/#!topic/golang-nuts/MmIDUzl8HA0 ... Atomic downgrading is often useful to avoid race window in between Unlock and RLock and, as consequence, having the need to recheck things after RLock. We can put this complexity and logic into well-defined RWMutex primitive instead of throwing it to be solved by every RWMutex user.
Showing
Please register or sign in to comment