blob: 4fd0128657e6852d6311ac6d425f82c1d590f55d [file] [log] [blame]
package disruptor
import "sync/atomic"
type Cursor [8]int64 // prevent false sharing of the sequence cursor by padding the CPU cache line with 64 *bytes* of data.
func NewCursor() *Cursor {
var this Cursor
this[0] = defaultCursorValue
return &this
}
func (this *Cursor) Store(value int64) { atomic.StoreInt64(&this[0], value) }
func (this *Cursor) Load() int64 { return atomic.LoadInt64(&this[0]) }
const defaultCursorValue = -1