trylock

package
v8.0.0-...-ae3472c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: ISC Imports: 3 Imported by: 1

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 "try lock" for coordinating multiple accessors, while allowing only a single updater. It is not very smart about queueing when there are multiple callers of Lock waiting.

func (*Mutex) Lock

func (tl *Mutex) Lock()

Lock acquires the lock. If it is already held, this blocks until it can be obtained.

func (*Mutex) TryLock

func (tl *Mutex) TryLock() bool

TryLock attempts to acquire the lock. If it returns true, the caller has obtained it exclusively, and should call Unlock when done with it. If it returns false, the lock was already held.

func (*Mutex) Unlock

func (tl *Mutex) Unlock()

Unlock releases the lock. Only the caller of Lock, or TryLock when true was returned, should call Unlock.

Jump to

Keyboard shortcuts

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