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

lock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

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

Locker guards one file against other goroutines with an RWMutex, and against other processes with a lock file. Both spin on a try-lock, so neither is fair: a writer cannot preempt a steady stream of readers, and every holder has to release quickly. That is the bargain the token cache is built on — a read is one field, a write is one token refresh.

func New

func New(path string) Locker

func (Locker) WithLock

func (l Locker) WithLock(ctx context.Context, fn func() error) error

func (Locker) WithRLock

func (l Locker) WithRLock(ctx context.Context, fn func() error) error

Jump to

Keyboard shortcuts

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