lockutil

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: CC0-1.0 Imports: 5 Imported by: 2

Documentation

Overview

Package lockutil contains a file based lock which can be used to lock file resources across different processes. The lock file is monitored by a Go routine. Invalidating the lock file (e.g. just writing a single character to it) causes the Go routine to exit. A client can check if the lockfile is still being monitored by calling WatcherRunning().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockFile

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

LockFile data structure

func NewLockFile

func NewLockFile(filename string, interval time.Duration) *LockFile

NewLockFile creates a new LockFile which and watch it in given intervals.

func (*LockFile) Finish

func (lf *LockFile) Finish() error

Finish watching a lockfile and return once the watcher goroutine has finished.

func (*LockFile) SetWatcherRunning added in v1.4.0

func (lf *LockFile) SetWatcherRunning(state bool)

SetWatcherRunning sets if the watcher goroutine is running.

func (*LockFile) Start

func (lf *LockFile) Start() error

Start creates the lockfile and starts watching it.

func (*LockFile) WatcherRunning

func (lf *LockFile) WatcherRunning() bool

WatcherRunning returns if the watcher goroutine is running.

Jump to

Keyboard shortcuts

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