lock

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

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 1 Imported by: 16

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
}

* Not sure why, but when I first looked for locks in golang, I was told Just use a channel!, so i did. I have not found a reason to go back and use the actual sync library since this actually works well and is just super simple a buffered channel can act as a semaphore where acquiring is writing to the channel and release is reading

func NewLock

func NewLock(name string) *Lock

* Locks have a name so they can be easily debugged when there is a deadlock and I forget to release it some where

func (*Lock) Acquire

func (lock *Lock) Acquire(loc string)

* Loc is also used for debugging

func (*Lock) EnableDebug

func (lock *Lock) EnableDebug()

func (*Lock) Release

func (lock *Lock) Release()

Jump to

Keyboard shortcuts

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