filelock

package
v0.2.1 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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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