sync

package module
v0.0.0-...-3aa86b5 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

README

sync

Drop-in replacement for sync's RWLock

Benchmarks

~/gopath/src/github.com/gramework/sync % go test -bench . -benchmem
testing: warning: no tests to run
BenchmarkGrameworkRWMutex/1-4 			100000000	        22.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkGrameworkRWMutex/4-4 			20000000	        64.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkGrameworkRWMutex/16-4         	20000000	        64.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkGrameworkRWMutex/64-4         	20000000	        64.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkGrameworkRWMutex/256-4        	20000000	        65.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkOrigRWMutex/1-4               	100000000	        23.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkOrigRWMutex/4-4               	20000000	        70.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkOrigRWMutex/16-4              	20000000	        71.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkOrigRWMutex/64-4              	20000000	        73.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkOrigRWMutex/256-4             	20000000	        73.4 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/gramework/sync	16.126s

(note: first two lines was modified: I've put two tabs after the test name.)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	Lock()
	Unlock()
}

A Locker represents an object that can be locked and unlocked.

type RWMutex

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

RWMutex is a fast drop-in replacement for sync.RWMutex

func (*RWMutex) Lock

func (lock *RWMutex) Lock()

Lock the RWMutex for read and write

func (*RWMutex) RLock

func (lock *RWMutex) RLock()

RLock the RWMutex for read only

func (*RWMutex) RLocker

func (lock *RWMutex) RLocker() sync.Locker

RLocker returns a Locker interface that implements the Lock and Unlock methods by calling rw.RLock and rw.RUnlock.

func (*RWMutex) RUnlock

func (lock *RWMutex) RUnlock()

RUnlock the RWMutex for read only

func (*RWMutex) Unlock

func (lock *RWMutex) Unlock()

Unlock the RWMutex for read and write

Jump to

Keyboard shortcuts

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