locks

package
v0.6.4-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReceiveFromChanWhenDone

func ReceiveFromChanWhenDone(callback func()) <-chan struct{}

ReceiveFromChanWhenDone takes a blocking function and returns a channel that sends an empty struct when the function is done.

Types

type PriorityMutex

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

PriorityMutex implements a lock with three priorities:

  • High priority write lock - locks the mutex with the highest priority.
  • High priority read lock - locks the mutex with lower priority than the high priority write lock. Can be held concurrently with other with other read locks.
  • Low priority write lock - locks the mutex with lower priority then the read lock.

func NewPriorityMutex

func NewPriorityMutex() *PriorityMutex

NewPriorityMutex returns a new priority mutex

func (*PriorityMutex) HighPriorityReadLock

func (mtx *PriorityMutex) HighPriorityReadLock()

HighPriorityReadLock acquires a high-priority read lock.

func (*PriorityMutex) HighPriorityReadUnlock

func (mtx *PriorityMutex) HighPriorityReadUnlock()

HighPriorityReadUnlock unlocks the high-priority read lock

func (*PriorityMutex) HighPriorityWriteLock

func (mtx *PriorityMutex) HighPriorityWriteLock()

HighPriorityWriteLock acquires a high-priority write lock.

func (*PriorityMutex) HighPriorityWriteUnlock

func (mtx *PriorityMutex) HighPriorityWriteUnlock()

HighPriorityWriteUnlock unlocks the high-priority write lock

func (*PriorityMutex) LowPriorityWriteLock

func (mtx *PriorityMutex) LowPriorityWriteLock()

LowPriorityWriteLock acquires a low-priority write lock.

func (*PriorityMutex) LowPriorityWriteUnlock

func (mtx *PriorityMutex) LowPriorityWriteUnlock()

LowPriorityWriteUnlock unlocks the low-priority write lock

Jump to

Keyboard shortcuts

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