package
module
Version:
v0.0.0-...-3aa86b5
Opens a new window with list of versions in this module.
Published: Feb 5, 2017
License: Apache-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
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
¶
type Locker interface {
Lock()
Unlock()
}
A Locker represents an object that can be locked and unlocked.
RWMutex is a fast drop-in replacement for sync.RWMutex
Lock the RWMutex for read and write
RLock the RWMutex for read only
RLocker returns a Locker interface that implements
the Lock and Unlock methods by calling rw.RLock and rw.RUnlock.
RUnlock the RWMutex for read only
Unlock the RWMutex for read and write
Source Files
¶
Click to show internal directories.
Click to hide internal directories.