Documentation
¶
Overview ¶
Package nbl provides various non-blocking algorithms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
Int64 implements int64 value for one writer and multiple readers. It is designed for architectures that does not support 64-bit atomic operations.
func (*Int64) Load ¶
Load uses ABA, TryLoad and CheckABA to load and return value of i.
BUG: On 32bit CPUs Load does not guarantee that it returns valid value. The probability of failure depends on the frequency of updates: 1 kHz: aba wraps onece per 1193 houres, 1 MHz: aba wraps once per 72 minutes. Load fails if aba wraps beetwen ABA and CheckABA or between subsequent CheckABA and after that is readed second time with the same value.
func (*Int64) WriterAdd ¶
WriterAdd performs i += v and returns new value of i. Only ONE writer can call WriterAdd at the same time.
func (*Int64) WriterLoad ¶
WriterLoad is more efficient than Load but there should be guarantee that only one writer can write to i at the same time.
func (*Int64) WriterStore ¶
WriterStore stores v into i. Only ONE writer can call WriterStore at the same time.