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

filelock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package filelock implements only the platform file-lock primitive. The parent driver resolves paths, coordinates process-wide lock identities, and retains ownership across session and transaction callback lifetimes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Acquire

func Acquire(ctx context.Context, path string, wait bool) (release func() error, acquired bool, err error)

Acquire takes an exclusive flock on path, creating the file when needed. With wait it polls with LOCK_NB so ctx ends the wait; without it, it reports acquired false at once when another process holds the lock. The kernel drops the lock when the process exits, so a crashed holder never blocks others. The returned release function unlocks and closes the file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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