Help us shape the future of Go! Take the 2026 Go Developer Survey

keylock

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package keylock serialises work per key: one holder of a key at a time, any number of keys at once. A key's lock lives while it is held or waited for, and is dropped afterwards, so a map of names does not grow with every name ever locked.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a set of locks by key. The zero value is ready to use.

func (*Map) Len

func (m *Map) Len() int

Len is the number of keys held or waited for (tests).

func (*Map) Lock

func (m *Map) Lock(key string) (unlock func())

Lock waits until key is free, takes it, and answers the function that gives it back (call it exactly once).

Jump to

Keyboard shortcuts

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