demotemutex

package module
v0.0.0-...-235395f Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2015 License: MIT Imports: 1 Imported by: 20

README

demotelock

Package demotemutex provides an extention to sync.Mutex that allows a writelock to be demoted to a readlock without releasing control to other writelocks.

Documentation

Overview

Package demotemutex provides an extention to sync.Mutex that allows a writelock to be demoted to a readlock without releasing control to other writelocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DemoteMutex

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

DemoteMutex is a DemoteMutex that allows 'demotion' - a writelock will demote such that readlocks are able to acquite the mutex, but other writelocks are still blocked.

func (*DemoteMutex) Demote

func (dm *DemoteMutex) Demote()

Demote will modify a writelocked DemoteMutex such that readlocks can acquire the mutex but writelocks are still blocked. After being demoted, the DemoteMutex must be unlocked by calling 'DemotedUnlock'.

func (*DemoteMutex) DemotedUnlock

func (dm *DemoteMutex) DemotedUnlock()

DemotedUnlock will fully unlock a lock that has been demoted.

func (*DemoteMutex) Lock

func (dm *DemoteMutex) Lock()

Lock will grab a writelock on a DemoteMutex. A writelocked DemoteMutex can be demoted such that readlocks can aquire the mutex but other writelocks are still blocked.

func (*DemoteMutex) RLock

func (dm *DemoteMutex) RLock()

RLock will grab a readlock on the DemoteMutex. RLock can share the mutex with demoted locks.

func (*DemoteMutex) RUnlock

func (dm *DemoteMutex) RUnlock()

RUnlock will release a readlock on the DemoteMutex.

func (*DemoteMutex) Unlock

func (dm *DemoteMutex) Unlock()

Unlock will fully unlock a DemoteMutex.

Jump to

Keyboard shortcuts

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