forked from TrueCloudLab/frostfs-node
[#411] Remove unnecessary pointers for sync objects
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
f934abed8f
commit
faca861451
20 changed files with 39 additions and 64 deletions
|
@ -25,19 +25,18 @@ type valueWithTime[V any] struct {
|
|||
}
|
||||
|
||||
type locker struct {
|
||||
mtx *sync.Mutex
|
||||
mtx sync.Mutex
|
||||
waiters int // not protected by mtx, must used outer mutex to update concurrently
|
||||
}
|
||||
|
||||
type keyLocker[K comparable] struct {
|
||||
lockers map[K]*locker
|
||||
lockersMtx *sync.Mutex
|
||||
lockersMtx sync.Mutex
|
||||
}
|
||||
|
||||
func newKeyLocker[K comparable]() *keyLocker[K] {
|
||||
return &keyLocker[K]{
|
||||
lockers: make(map[K]*locker),
|
||||
lockersMtx: &sync.Mutex{},
|
||||
lockers: make(map[K]*locker),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +52,6 @@ func (l *keyLocker[K]) LockKey(key K) {
|
|||
}
|
||||
|
||||
locker := &locker{
|
||||
mtx: &sync.Mutex{},
|
||||
waiters: 1,
|
||||
}
|
||||
locker.mtx.Lock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue