Back to

Package flock

Latest Go to latest

The latest major version is .

Published: Jun 24, 2020 | License: Apache-2.0 | Module:


Package flock implements a simple POSIX file-based advisory lock.


type T

type T struct {
	// contains filtered or unexported fields

func New

func New(path string) *T

New creates an object that locks the given path.

func (*T) Lock

func (f *T) Lock(ctx context.Context) (err error)

Lock locks the file. Iff Lock() returns nil, the caller must call Unlock() later.

func (*T) Unlock

func (f *T) Unlock() error

Unlock unlocks the file.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier