syncutil

package
v0.0.0-...-6c10b0c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 1 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 {
	sync.Mutex
}

A Mutex is a mutual exclusion lock.

func (*Mutex) AssertHeld

func (m *Mutex) AssertHeld()

AssertHeld may panic if the mutex is not locked (but it is not required to do so). Functions which require that their callers hold a particular lock may use this to enforce this requirement more directly than relying on the race detector.

Note that we do not require the lock to be held by any particular thread, just that some thread holds the lock. This is both more efficient and allows for rare cases where a mutex is locked in one thread and used in another.

type RWMutex

type RWMutex struct {
	sync.RWMutex
}

An RWMutex is a reader/writer mutual exclusion lock.

func (*RWMutex) AssertHeld

func (m *RWMutex) AssertHeld()

AssertHeld may panic if the mutex is not locked for writing (but it is not required to do so). Functions which require that their callers hold a particular lock may use this to enforce this requirement more directly than relying on the race detector.

Note that we do not require the lock to be held by any particular thread, just that some thread holds the lock. This is both more efficient and allows for rare cases where a mutex is locked in one thread and used in another.

Jump to

Keyboard shortcuts

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