Documentation
¶
Overview ¶
Package lock provides lock implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex is a struct that provides mutex related methods.
type MutexByKey ¶
type MutexByKey struct {
// contains filtered or unexported fields
}
MutexByKey is a struct that provides mutex-related methods for each key.
func (*MutexByKey) Delete ¶
func (this *MutexByKey) Delete(key any)
Delete deletes the mutex corresponding to the key.
ex) mutexs.Delete(key)
func (*MutexByKey) Lock ¶
func (this *MutexByKey) Lock(key any)
Lock locks the mutex corresponding to the key.
ex) mutexs.Lock(key)
func (*MutexByKey) TryLock ¶
func (this *MutexByKey) TryLock(key any) bool
TryLock attempts to lock the mutex corresponding to the key and returns whether it was successful or not.
ex) result := mutexs.TryLock(key)
func (*MutexByKey) Unlock ¶
func (this *MutexByKey) Unlock(key any)
Unlock unlocks the mutex corresponding to the key.
ex) mutexs.Unlock(key)
func (*MutexByKey) UnlockAndDelete ¶
func (this *MutexByKey) UnlockAndDelete(key any)
UnlockAndDelete unlocks and deletes the mutex corresponding to the key.
ex) mutexs.UnlockAndDelete(key)