补充实现细节

This commit is contained in:
dragon
2025-01-07 17:04:39 +08:00
parent bb8966521c
commit 0172dceaa8
9 changed files with 278 additions and 49 deletions

View File

@@ -11,6 +11,7 @@ func NewLocker() *Locker {
sy: sync.Map{},
}
}
func (l *Locker) Open(key string) *sync.Mutex {
actual, _ := l.sy.LoadOrStore(key, &sync.Mutex{})
return actual.(*sync.Mutex)