filelock

package
v0.0.0-...-3c8a918 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2015 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLock

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

FileLock object can be used to create locks that can be used to synchronise different processes running on the same machine. The current implementation of FileLock will always release all acquired locks once the process itself exits. NOTE: FileLock is not thread safe, since it is not meant to be used from multiple threads but from different processes instead!

func New

func New(name string) *FileLock

Creates new FileLock object given a unique name.

func (*FileLock) Lock

func (f *FileLock) Lock() error

Blocking way to acquire the lock.

func (*FileLock) TryLock

func (f *FileLock) TryLock() error

Non blocking way to try to acquire the lock.

func (*FileLock) Unlock

func (f *FileLock) Unlock() error

Unlocks the lock. If the Lock was never acquired before it will cause a panic.

Jump to

Keyboard shortcuts

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