filelock

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package filelock provides an exclusive, non-blocking file lock with the same "already in use by another process" semantics on every OS.

Unix uses flock(LOCK_EX|LOCK_NB); Windows uses LockFileEx with LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY. The .lock pidfile contents are unchanged; only the mechanism is per-OS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lock

func Lock(f *os.File) error

Lock takes a non-blocking exclusive lock on f. It returns an error when another process holds the lock.

func Unlock

func Unlock(f *os.File) error

Unlock releases a lock taken with Lock.

Types

This section is empty.

Jump to

Keyboard shortcuts

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