Documentation ¶
Index ¶
- type SeqLock
- func (seq *SeqLock) LiveLogger(ms int64)
- func (seq *SeqLock) RdAgain(val uint64) bool
- func (seq *SeqLock) RdRead() uint64
- func (seq *SeqLock) ResetCounter()
- func (seq *SeqLock) TimeBlock(ms int64)
- func (seq *SeqLock) TimeReadBenchmark() uint64
- func (seq *SeqLock) TimeWriteBenchmark() uint64
- func (seq *SeqLock) WrLock()
- func (seq *SeqLock) WrUnlock()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SeqLock ¶
SeqLock Counter increases by 1 everytime the lock gets taken or released by writer sequence number is other name for it inherited mutex is used only by writers
func NewSeqLock ¶
func NewSeqLock() *SeqLock
func (*SeqLock) LiveLogger ¶
LiveLogger Logs current counter value and for how long it has been running to the standard output
func (*SeqLock) RdAgain ¶
RdAgain checks if data is not being modified by writer or if it has not been modified since rdRead func
func (*SeqLock) RdRead ¶
RdRead reads counter using atomic operations used before accessing data protected by the lock
func (*SeqLock) ResetCounter ¶
func (seq *SeqLock) ResetCounter()
ResetCounter resets counter to zero
func (*SeqLock) TimeBlock ¶
TimeBlock locks the data for both writers and readers for the given amount of miliseconds beware that it locks once all writers before it are finished
func (*SeqLock) TimeReadBenchmark ¶
TimeReadBenchmark checks for how much time the reader has to keep repeating the reading process (in ms) better to use it multiple times and average results
func (*SeqLock) TimeWriteBenchmark ¶
TimeWriteBenchmark checks for how much time the lock is blocked until new writer gets access to it (in ms) better to use it multiple times and average results