sync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountingRWMutex

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

CountingRWMutex is a RWMutex that keeps track of the number of goroutines waiting for the lock.

func NewCountingRWMutex

func NewCountingRWMutex(limit int) *CountingRWMutex

func (*CountingRWMutex) Lock

func (rw *CountingRWMutex) Lock()

Lock locks rw for writing.

func (*CountingRWMutex) RLock

func (rw *CountingRWMutex) RLock()

RLock locks rw for reading.

func (*CountingRWMutex) RUnlock

func (rw *CountingRWMutex) RUnlock()

RUnlock undoes a single RLock call; it does not affect other simultaneous readers.

func (*CountingRWMutex) TryLock

func (rw *CountingRWMutex) TryLock() bool

TryLock tries to lock rw for writing if the pending waitinger is less than the limit.

func (*CountingRWMutex) Unlock

func (rw *CountingRWMutex) Unlock()

Unlock undoes a single Lock call; it does not affect other simultaneous readers.

func (*CountingRWMutex) Waiters

func (rw *CountingRWMutex) Waiters() int64

Waiters returns the number of goroutines waiting for the lock.

Jump to

Keyboard shortcuts

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