filelock

package
v0.0.0-...-2608902 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

filelock provides a machine wide file lock.

Index

Constants

View Source
const (
	// NameRegexp specifies the regular expression used to identify valid lock names.
	NameRegexp = "^[a-z]+[a-z0-9.-]*$"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

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

Lock represents a machine wide file lock.

func NewLock

func NewLock(dir, name string) (*Lock, error)

NewLock returns a new lock with the given name, using the given lock directory, without acquiring it. The lock name must match the regular expression defined by NameRegexp.

func (*Lock) Lock

func (lock *Lock) Lock(message string) error

Lock blocks until it is able to acquire the lock. It is good behaviour to provide a message that is output in debugging information.

func (*Lock) Unlock

func (lock *Lock) Unlock() error

Unlock releases a held lock.

Jump to

Keyboard shortcuts

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