timeoutlock

package
v0.0.0-...-137c36e Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

Mutex is a lock for long-running tasks where Lock can be interrupted by canceling a context.

func NewMutex

func NewMutex() Mutex

func (*Mutex) Lock

func (l *Mutex) Lock(ctx context.Context) bool

Lock blocks forever until the lock is free, attempting every 100 ms until the context is cancelled. Lock must be unlocked with Unlock() On success returns true. If context cancelled returns false.

func (*Mutex) Unlock

func (l *Mutex) Unlock()

Jump to

Keyboard shortcuts

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