devlock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() string

func Disabled

func Disabled() bool

func Probe added in v0.6.4

func Probe(serial string) (Owner, State)

Types

type Busy

type Busy struct {
	Serial string
	Owner  Owner
}

func IsBusy

func IsBusy(err error) (*Busy, bool)

func (*Busy) Error

func (e *Busy) Error() string

type Lock

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

func Acquire

func Acquire(ctx context.Context, serial, what string, wait time.Duration) (*Lock, error)

func TryAcquire

func TryAcquire(serial, what string) (*Lock, error)

func (*Lock) Release

func (l *Lock) Release()

type Owner

type Owner struct {
	PID     int       `json:"pid"`
	What    string    `json:"what"`
	Dir     string    `json:"dir,omitempty"`
	Since   time.Time `json:"since"`
	Command string    `json:"command,omitempty"`
}

func Holder

func Holder(serial string) Owner

func (Owner) String

func (o Owner) String() string

type State added in v0.6.4

type State int
const (
	Unknown State = iota
	Free
	Held
)

Jump to

Keyboard shortcuts

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