lock

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

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.

func (*Mutex) Lock

func (this *Mutex) Lock()

Lock is lock.

ex) mutex.Lock()

func (*Mutex) TryLock

func (this *Mutex) TryLock() bool

TryLock attempts a lock and returns whether it was successful or not.

ex) result := mutex.TryLock()

func (*Mutex) Unlock

func (this *Mutex) Unlock()

Unlock is unlock.

ex) mutex.Unlock()

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL