rwc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 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 RWCMutex

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

func New

func New() *RWCMutex

func (*RWCMutex) Lock

func (l *RWCMutex) Lock()

Lock locks write workloads

func (*RWCMutex) RLock

func (l *RWCMutex) RLock()

RLock allows read workloads to wait for writers to complete.

func (*RWCMutex) RUnlock

func (l *RWCMutex) RUnlock()

RUnlock signals that a read workload is completed, so that a writer can start

func (*RWCMutex) Unlock

func (l *RWCMutex) Unlock()

Unlock releases locked write workloads

type RWCMutexer

type RWCMutexer interface {
	RLock()
	RUnlock()
	Lock()
	Unlock()
}

RWCMutexer is mostly just a copy & paste from sync.RWMutex but with channels. It outperforms sync.RWMutex on workloads with many short-read locks scenarios versus small wlock. See benchmarks for context

Jump to

Keyboard shortcuts

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