filelock

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

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