lock

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locks

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

Locks provides rw locks for key

func Make

func Make(tableSize int) *Locks

Make creates a new lock map

func (*Locks) Lock

func (locks *Locks) Lock(key string)

Lock obtains exclusive lock for writing

func (*Locks) Locks

func (locks *Locks) Locks(keys ...string)

Locks obtains multiple exclusive locks for writing invoking Lock in loop may cause dead lock, please use Locks

func (*Locks) RLock

func (locks *Locks) RLock(key string)

RLock obtains shared lock for reading

func (*Locks) RLocks

func (locks *Locks) RLocks(keys ...string)

RLocks obtains multiple shared locks for reading invoking RLock in loop may cause dead lock, please use RLocks

func (*Locks) RUnLock

func (locks *Locks) RUnLock(key string)

RUnLock release shared lock

func (*Locks) RUnLocks

func (locks *Locks) RUnLocks(keys ...string)

RUnLocks releases multiple shared locks

func (*Locks) RWLocks added in v1.2.7

func (locks *Locks) RWLocks(writeKeys []string, readKeys []string)

RWLocks locks write keys and read keys together. allow duplicate keys

func (*Locks) RWUnLocks added in v1.2.7

func (locks *Locks) RWUnLocks(writeKeys []string, readKeys []string)

RWUnLocks unlocks write keys and read keys together. allow duplicate keys

func (*Locks) UnLock

func (locks *Locks) UnLock(key string)

UnLock release exclusive lock

func (*Locks) UnLocks

func (locks *Locks) UnLocks(keys ...string)

UnLocks releases multiple exclusive locks

Jump to

Keyboard shortcuts

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