- 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.