kmutex

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: GPL-3.0 Imports: 1 Imported by: 20

README

GoDoc

kmutex

Sync primitive for golang. Allow block part of resource by unique ID.

GO PLAYGROUND EXAMPLE

Documentation

Overview

Package kmutex is synchronization primitive. Mutex which can be locked by unique ID. Key + Mutex = Kmutex

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kmutex

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

Can be locked by unique ID

func New

func New() *Kmutex

Create new Kmutex

func WithLock

func WithLock(l sync.Locker) *Kmutex

Create new Kmutex with user provided lock

func (*Kmutex) Lock

func (km *Kmutex) Lock(key interface{})

Lock Kmutex by unique ID

func (Kmutex) Locker

func (km Kmutex) Locker(key interface{}) sync.Locker

Return a object which implement sync.Locker interface A Locker represents an object that can be locked and unlocked.

func (*Kmutex) Unlock

func (km *Kmutex) Unlock(key interface{})

Unlock Kmutex by unique ID

Jump to

Keyboard shortcuts

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