lockfile

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLockBusy = errors.New("lock busy: held by another process")

ErrLockBusy is returned when a non-blocking lock cannot be acquired because another process holds a conflicting lock.

View Source
var ErrLocked = errProcessLocked

ErrLocked is returned when a lock cannot be acquired because it is held by another process.

Functions

func FlockExclusiveBlocking

func FlockExclusiveBlocking(f *os.File) error

FlockExclusiveBlocking acquires an exclusive blocking lock on the file. This will wait until the lock is available.

func FlockExclusiveNonBlock

func FlockExclusiveNonBlock(f *os.File) error

FlockExclusiveNonBlock acquires an exclusive non-blocking lock on the file. Returns ErrLockBusy if any lock (shared or exclusive) is already held.

func FlockExclusiveNonBlocking

func FlockExclusiveNonBlocking(f *os.File) error

FlockExclusiveNonBlocking attempts to acquire an exclusive lock without blocking. Returns ErrLocked if the lock is held by another process.

func FlockSharedNonBlock

func FlockSharedNonBlock(f *os.File) error

FlockSharedNonBlock acquires a shared non-blocking lock on the file. Multiple processes can hold shared locks concurrently. Returns ErrLockBusy if an exclusive lock is already held.

func FlockUnlock

func FlockUnlock(f *os.File) error

FlockUnlock releases a lock on the file.

func IsLocked

func IsLocked(err error) bool

IsLocked returns true if the error indicates a lock is held by another process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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