1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2026-07-25 00:36:32 +08:00
This commit is contained in:
2022-05-26 14:12:42 +08:00
parent a5cc6eb04c
commit a31e054a70
3 changed files with 6 additions and 18 deletions
+1 -4
View File
@@ -1,9 +1,6 @@
package locker
// 空锁
var _ Locker = &emptyLocker{}
var _ RWLocker = &emptyLocker{}
var EmptyLocker = &emptyLocker{}
type emptyLocker struct{}
+2 -7
View File
@@ -15,11 +15,6 @@ type RWLocker interface {
TryRLock() bool
}
type locker struct {
*sync.Mutex
func NewLocker() *sync.Mutex {
return &sync.Mutex{}
}
func NewLocker() *locker {
return &locker{Mutex: &sync.Mutex{}}
}
+3 -7
View File
@@ -2,12 +2,8 @@ package locker
import "sync"
var _ RWLocker = &rwLocker{}
var _ RWLocker = &sync.RWMutex{}
type rwLocker struct {
*sync.RWMutex
}
func NewRWLocker() *rwLocker {
return &rwLocker{RWMutex: &sync.RWMutex{}}
func NewRWLocker() *sync.RWMutex {
return &sync.RWMutex{}
}