rwuMutex

package module
v0.0.0-...-994bf8c Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 1 Imported by: 0

README

rwumutex

Upgradeable RWMutex written in Go. I made this to build a toy DBMS with no-wait.

rwuMutex's state

 n : n read lock
 0 : no lock
-1 : write lock

API

- GetState() int32
- TryLock() bool
- TryRLock() bool
- Unlock()
- RUnlock()
- TryUpgrade() bool

LICENSE

MIT

Documentation

Index

Constants

View Source
const (
	WriterExist = -1
	NotExist    = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RWUMutex

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

func (*RWUMutex) GetState

func (mu *RWUMutex) GetState() int32

func (*RWUMutex) RUnlock

func (mu *RWUMutex) RUnlock()

func (*RWUMutex) TryLock

func (mu *RWUMutex) TryLock() bool

func (*RWUMutex) TryRLock

func (mu *RWUMutex) TryRLock() bool

func (*RWUMutex) TryUpgrade

func (mu *RWUMutex) TryUpgrade() bool

func (*RWUMutex) Unlock

func (mu *RWUMutex) Unlock()

Jump to

Keyboard shortcuts

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