filelock

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 7 Imported by: ? 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

Index

Constants

View Source
const DIRECTORY_LOCK = ".lock"

Variables

This section is empty.

Functions

func Lock

func Lock(path string) (io.Closer, error)

func LockDir

func LockDir(dir string) (io.Closer, error)

Types

type Mutex

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

Mutex is a lock object based on a file. It features a process lock and an in-process mutex. Therefore, it can be used in a GO program in multiple Go-routines to achieve a global synchronization among multiple processes on the same machine. The result of a Lock operation is an io.Closer which is used to release the lock again.

func MutexFor

func MutexFor(path string) (*Mutex, error)

MutexFor provides a canonical lock for the given file. If the file path describes a directory, the lock will be the file .lock inside this directory.

func (*Mutex) Lock

func (m *Mutex) Lock() (io.Closer, error)

func (*Mutex) Path

func (m *Mutex) Path() string

func (*Mutex) TryLock

func (m *Mutex) TryLock() (io.Closer, error)

Jump to

Keyboard shortcuts

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