sync

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond

type Cond struct {
	L Locker
	// contains filtered or unexported fields
}

func NewCond

func NewCond(l Locker) *Cond

func (*Cond) Broadcast

func (c *Cond) Broadcast()

func (*Cond) Signal

func (c *Cond) Signal()

func (*Cond) Wait

func (c *Cond) Wait()

type Locker

type Locker interface {
	Lock()
	Unlock()
}

type Map

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

func (*Map) Delete

func (m *Map) Delete(key interface{})

func (*Map) Load

func (m *Map) Load(key interface{}) (value interface{}, ok bool)

func (*Map) LoadOrStore

func (m *Map) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool)

func (*Map) Range

func (m *Map) Range(f func(key, value interface{}) bool)

func (*Map) Store

func (m *Map) Store(key, value interface{})

type Mutex

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

func (*Mutex) Lock

func (m *Mutex) Lock()

func (*Mutex) Unlock

func (m *Mutex) Unlock()

type Once

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

func (*Once) Do

func (o *Once) Do(f func())

type Pool

type Pool struct {
	New func() interface{}
}

Pool is a very simple implementation of sync.Pool. It does not actually implement a pool.

func (*Pool) Get

func (p *Pool) Get() interface{}

Get returns the value of calling Pool.New().

func (*Pool) Put

func (p *Pool) Put(x interface{})

Put drops the value put into the pool.

type RWMutex

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

An RWMutex is a reader/writer mutual exclusion lock. The lock can be held by an arbitrary number of readers or a single writer. RWMutexes can be created as part of other structures; the zero value for a RWMutex is an unlocked mutex.

An RWMutex must not be copied after first use.

If a goroutine holds a RWMutex for reading, it must not expect this or any other goroutine to be able to also take the read lock until the first read lock is released. In particular, this prohibits recursive read locking. This is to ensure that the lock eventually becomes available; a blocked Lock call excludes new readers from acquiring the lock.

func (*RWMutex) Lock

func (rw *RWMutex) Lock()

Lock locks rw for writing. If the lock is already locked for reading or writing, Lock blocks until the lock is available.

func (*RWMutex) RLock

func (rw *RWMutex) RLock()

RLock locks rw for reading.

func (*RWMutex) RLocker

func (rw *RWMutex) RLocker() Locker

RLocker returns a Locker interface that implements the Lock and Unlock methods by calling rw.RLock and rw.RUnlock.

func (*RWMutex) RUnlock

func (rw *RWMutex) RUnlock()

RUnlock undoes a single RLock call; it does not affect other simultaneous readers. It is a run-time error if rw is not locked for reading on entry to RUnlock.

func (*RWMutex) Unlock

func (rw *RWMutex) Unlock()

Unlock unlocks rw for writing. It is a run-time error if rw is not locked for writing on entry to Unlock.

As with Mutexes, a locked RWMutex is not associated with a particular goroutine. One goroutine may RLock (Lock) an RWMutex and then arrange for another goroutine to RUnlock (Unlock) it.

type WaitGroup

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

func (*WaitGroup) Add

func (wg *WaitGroup) Add(delta int)

func (*WaitGroup) Done

func (wg *WaitGroup) Done()

func (*WaitGroup) Wait

func (wg *WaitGroup) Wait()

Directories

Path Synopsis
Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.
Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.

Jump to

Keyboard shortcuts

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