locks

package
v0.0.0-...-3386a5b Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2017 License: Apache-2.0 Imports: 0 Imported by: 25

Documentation

Index

Constants

View Source
const (
	LOCK operation = iota
	UNLOCK
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	Lock() Unlocker
}

func KeyLocker

func KeyLocker(key interface{}) Locker

KeyLocker provides an application-wide locker on the specified key.

func NopLocker

func NopLocker() Locker

NopLocker returns a Locker which always works but does nothing: it's used to effectively skip locking.

type Unlocker

type Unlocker interface {
	Unlock()
}

Unlocker Interface for unlocking a key that was provided to Lock()

func Lock

func Lock(key interface{}) Unlocker

Lock function provides a backwards compatible API for application-wide locking on a key

Jump to

Keyboard shortcuts

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