Help us shape the future of Go! Take the 2026 Go Developer Survey

csync

package
v1.34.9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex added in v1.23.7

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

Mutex implements a mutex with a Broadcast. Implements a mutex that accepts a Context. An empty value Mutex{} is valid.

func (*Mutex) Lock added in v1.23.7

func (m *Mutex) Lock(ctx context.Context) (func(), error)

Lock attempts to hold a lock on the Mutex. Returns a lock release function or an error.

func (*Mutex) Locker added in v1.23.7

func (m *Mutex) Locker() sync.Locker

Locker returns a MutexLocker that uses context.Background to lock the Mutex.

func (*Mutex) TryLock added in v1.23.7

func (m *Mutex) TryLock() (func(), bool)

TryLock attempts to hold a lock on the Mutex. Returns a lock release function or nil if the lock could not be grabbed.

type MutexLocker added in v1.23.7

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

MutexLocker implements Locker for a Mutex.

func (*MutexLocker) Lock added in v1.23.7

func (l *MutexLocker) Lock()

Lock implements the sync.Locker interface.

func (*MutexLocker) Unlock added in v1.23.7

func (l *MutexLocker) Unlock()

Unlock implements the sync.Locker interface.

type RWMutex

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

RWMutex implements a RWMutex with a Broadcast. Implements a RWMutex that accepts a Context. An empty value RWMutex{} is valid.

func (*RWMutex) Lock

func (m *RWMutex) Lock(ctx context.Context, write bool) (func(), error)

Lock attempts to hold a lock on the RWMutex. Returns a lock release function or an error. A single writer OR many readers can hold Lock at a time. If a writer is waiting to lock, readers will wait for it.

func (*RWMutex) Locker

func (m *RWMutex) Locker() sync.Locker

Locker returns an RWMutexLocker that uses context.Background to write lock the RWMutex.

func (*RWMutex) RLocker

func (m *RWMutex) RLocker() sync.Locker

RLocker returns an RWMutexLocker that uses context.Background to read lock the RWMutex.

func (*RWMutex) TryLock

func (m *RWMutex) TryLock(write bool) (func(), bool)

TryLock attempts to hold a lock on the RWMutex. Returns a lock release function or nil if the lock could not be grabbed. A single writer OR many readers can hold Lock at a time. If a writer is waiting to lock, readers will wait for it.

type RWMutexLocker

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

RWMutexLocker implements Locker for a RWMutex.

func (*RWMutexLocker) Lock

func (l *RWMutexLocker) Lock()

Lock implements the sync.Locker interface.

func (*RWMutexLocker) Unlock

func (l *RWMutexLocker) Unlock()

Unlock implements the sync.Locker interface.

Jump to

Keyboard shortcuts

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