muctx

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

Lock represents a locked key in a mutex map, normally only returned as an unlock function but wrapped here to provide a storable type with metadata for context values.

func LockCtx

func LockCtx(mm *mutexes.MutexMap, ctx context.Context, key string) (child context.Context, lock *Lock)

LockCtx will check given context for lock, else acquire a lock on the mutex at key in the map.

func RLockCtx

func RLockCtx(mm *mutexes.MutexMap, ctx context.Context, key string) (child context.Context, lock *Lock)

RLockCtx will check given context for rlock, else acquire an rlock on the mutex at key in the map.

func (*Lock) Clone

func (ctx *Lock) Clone() *Lock

Clone returns a read-only clone of Lock.

func (*Lock) IsLock

func (ctx *Lock) IsLock() bool

IsLock returns whether this Lock is a write lock.

func (*Lock) IsRLock

func (ctx *Lock) IsRLock() bool

IsRLock returns whether this Lock is a read lock.

func (*Lock) Locked

func (ctx *Lock) Locked() bool

Locked returns whether Lock is currently locked.

func (*Lock) Unlock

func (ctx *Lock) Unlock() bool

Unlock will unlock the given Lock (only if it is not a read-only).

Jump to

Keyboard shortcuts

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