filelock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package filelock provides an exclusive advisory lock on a file, shared by concurrent goroutines and processes.

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
}

Lock is a held exclusive lock.

func Acquire

func Acquire(path string) (*Lock, error)

Acquire creates path if needed (mode 0600) and blocks until it holds an exclusive lock on it. Callers lock a dedicated lock file, never the data file, so atomic rename of the data file cannot orphan the lock.

func (*Lock) Release

func (l *Lock) Release()

Release drops the lock. It is safe to call more than once.

Jump to

Keyboard shortcuts

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