filelock

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const FileLockPollInterval = 50 * time.Millisecond

FileLockPollInterval is how often to retry acquiring the file lock.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

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

Locker provides file-based locking with timeout.

func New

func New(lockPath string, timeout time.Duration) *Locker

New creates a Locker for the given lock file path.

func (*Locker) Acquire

func (l *Locker) Acquire() (unlock func() error, err error)

Acquire acquires the file lock and returns an unlock function. The caller must call the unlock function to release the lock.

func (*Locker) WithLock

func (l *Locker) WithLock(fn func() error) (retErr error)

WithLock executes fn while holding the lock.

Jump to

Keyboard shortcuts

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