single

package module
v0.0.0-...-9f8d812 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 6 Imported by: 43 modules, 41 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.

README

single

This package will no longer be maintained, please use github.com/postfinance/single instead.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyRunning -- the instance is already running
	ErrAlreadyRunning = errors.New("the program is already running")
	// Lockfile -- the lock file to check
	Lockfile string
)

Functions

This section is empty.

Types

type Single

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

Single represents the name and the open file descriptor

func New

func New(name string) *Single

New creates a Single instance

func (*Single) CheckLock

func (s *Single) CheckLock() error

CheckLock tries to obtain an exclude lock on a lockfile and returns an error if one occurs

func (*Single) Filename

func (s *Single) Filename() string

Filename returns an absolute filename, appropriate for the operating system

func (*Single) Lock

func (s *Single) Lock()

Lock tries to obtain an exclude lock on a lockfile and exits the program if an error occurs

func (*Single) TryUnlock

func (s *Single) TryUnlock() error

TryUnlock unlocks, closes and removes the lockfile

func (*Single) Unlock

func (s *Single) Unlock()

Unlock releases the lock, closes and removes the lockfile. All errors will be reported directly.

Jump to

Keyboard shortcuts

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