1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
Files
go-mixed/locker/locker.go
2022-05-12 14:32:36 +08:00

26 lines
271 B
Go

package locker
import "sync"
type Locker interface {
Lock()
Unlock()
TryLock() bool
}
type RWLocker interface {
Locker
RLock()
RUnlock()
TryRLock() bool
}
type locker struct {
*sync.Mutex
}
func NewLocker() *locker {
return &locker{Mutex: &sync.Mutex{}}
}