syncutil

package
v0.0.0-...-220c46c Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFloat64

func LoadFloat64(addr *AtomicFloat64) (val float64)

LoadFloat64 atomically loads tha float64 value from the provided address.

func StoreFloat64

func StoreFloat64(addr *AtomicFloat64, val float64)

StoreFloat64 atomically stores a float64 value into the provided address.

Types

type AtomicFloat64

type AtomicFloat64 uint64

AtomicFloat64 mimics the atomic types in the sync/atomic standard library, but for the float64 type. If you'd like to implement additional methods, consider checking out the expvar Float type for guidance: https://golang.ir/src/expvar/expvar.go?s=2188:2222#L69

type Mutex

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

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.

func (*Mutex) Lock

func (m *Mutex) Lock()

Lock implements sync.Locker.

func (*Mutex) Unlock

func (m *Mutex) Unlock()

Unlock implements sync.Locker.

type RWMutex

type RWMutex struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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.

func (*RWMutex) Lock

func (m *RWMutex) Lock()

Lock implements sync.Locker.

func (*RWMutex) Unlock

func (m *RWMutex) Unlock()

Unlock implements sync.Locker.

Jump to

Keyboard shortcuts

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