seqlock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package seqlock implements a simple example of a seqlock which provides non-waiting reads on a data structure that is undergoing concurrent writes. See https://en.wikipedia.org/wiki/Seqlock

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seqlock

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

func New

func New() *Seqlock

func (*Seqlock) Get

func (s *Seqlock) Get() (ret [1024]byte)

Get returns the data in the seqlock

func (*Seqlock) Put

func (s *Seqlock) Put(v [1024]byte)

Put replaces the data in the seqlock

func (*Seqlock) Update

func (s *Seqlock) Update(fn func(data []byte) error) error

Update applies the update function to the data in the seqlock. If the function returns an error then the update is aborted.

Jump to

Keyboard shortcuts

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