lockfile

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 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

Advisory file locks shared between icebath processes

Index

Constants

This section is empty.

Variables

View Source
var ErrHeld = errors.New("held by another process")

Error of Try when another process holds the lock

Functions

func Held

func Held(path string) (bool, error)

Reports whether the lock of path is held through any other descriptor, in this process or another, false when the file does not exist, without creating it

Types

type Lock

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

Exclusive lock on a file held until Release

func Acquire

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

Opens or creates path and takes its lock, blocking until it is granted

func Try

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

Opens or creates path and takes its lock, failing with ErrHeld when another process holds it

func (*Lock) Release

func (l *Lock) Release() error

Releases the lock and closes the file, leaving it in place

Jump to

Keyboard shortcuts

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