README

A Go (golang) implementation of an upgradable RW lock.

Expand ▾ Collapse ▴

Documentation

Overview

Package rumutex implements an upgradable reader/writer mutual exclusion lock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RUMutex

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

An RUMutex is an upgradable reader/writer mutual exclusion lock. The lock can be held by an arbitrary number of readers or a single writer.

func (*RUMutex) Downgrade

func (ru *RUMutex) Downgrade()

Downgrade downgrades a write locked ru back to shared reading.

func (*RUMutex) RLock

func (ru *RUMutex) RLock()

RLock locks ru for shared reading.

func (*RUMutex) RUnlock

func (ru *RUMutex) RUnlock()

RUnlock unlocks a read locked ru.

func (*RUMutex) Unlock

func (ru *RUMutex) Unlock()

Unlock unlocks a write locked ru.

func (*RUMutex) Upgrade

func (ru *RUMutex) Upgrade() bool

Upgrade attempts to upgrade a read locked ru to exclusive writing. Returns false if the lock is already being upgraded.

Source Files