handy

package
v0.0.0-...-9d95335 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LockUnlock

func LockUnlock(m *sync.Mutex) func()

LockUnlock lock on mutex and return unlock. e.g. defer LockUnlock(mutex)

func RWLockUnlock

func RWLockUnlock(m *sync.RWMutex) func()

RWLockUnlock lock on mutex and return unlock. e.g. defer LockUnlock(mutex)

func RWRLockRUnlock

func RWRLockRUnlock(m *sync.RWMutex) func()

RWRLockRUnlock lock on mutex and return unlock. e.g. defer LockUnlock(mutex)

Types

type Lock

type Lock struct {
	sync.Mutex
}

func (*Lock) LockDeferUnlock

func (l *Lock) LockDeferUnlock() func()

func (*Lock) TryLock

func (l *Lock) TryLock() bool

func (*Lock) WithLock

func (l *Lock) WithLock(f func())

WithLock run code within protection of lock.

type RWLock

type RWLock struct {
	sync.RWMutex
}

func (*RWLock) LockDeferUnlock

func (l *RWLock) LockDeferUnlock() func()

func (*RWLock) RLockDeferRUnlock

func (l *RWLock) RLockDeferRUnlock() func()

func (*RWLock) TryLock

func (l *RWLock) TryLock() bool

func (*RWLock) WithLock

func (l *RWLock) WithLock(f func())

WithLock run code within protection of lock.

func (*RWLock) WithRLock

func (l *RWLock) WithRLock(f func())

WithRLock run code within protection of lock.

Jump to

Keyboard shortcuts

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