Skip to content

v3.4.0

Latest
Compare
Choose a tag to compare
@puzpuzpuz puzpuzpuz released this 14 Jul 11:13
5f67a12
  • Add optimistic locking methods to RBMutex #138 and #140
  • Fix Map/MapOf capacity calculation for WithPresize #139

RBMutex now has methods for optimistic locking:

mu := xsync.NewRBMutex()
if locked, t := mu.TryRLock(); locked {
	// critical reader section...
	mu.RUnlock(t)
}
if mu.TryLock() {
	// critical writer section...
	mu.Unlock()
}

Thanks @kkroo for the contribution.