cascase

package module
v0.0.0-...-581be24 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 3 Imported by: 0

README

CAS (compare and swap)

go test -run='^$' -bench=. -count=1 -benchtime=2s
goos: darwin
goarch: arm64
pkg: github.com/aggresss/playground-go/workbench/cas-case
BenchmarkStack/*cascase.LockFreeStack-8                  6901698               322.6 ns/op
BenchmarkStack/*cascase.MutexStack-8                    15968930               183.7 ns/op
PASS
ok      github.com/aggresss/playground-go/workbench/cas-case    7.549s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockFreeStack

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

func NewLockFreeStack

func NewLockFreeStack() *LockFreeStack

func (*LockFreeStack) Pop

func (s *LockFreeStack) Pop() (v interface{})

func (*LockFreeStack) Push

func (s *LockFreeStack) Push(v interface{})

type MutexStack

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

func NewMutexStack

func NewMutexStack() *MutexStack

func (*MutexStack) Pop

func (s *MutexStack) Pop() (v interface{})

func (*MutexStack) Push

func (s *MutexStack) Push(v interface{})

type StackInterface

type StackInterface interface {
	Push(interface{})
	Pop() interface{}
}

Stack 接口

Jump to

Keyboard shortcuts

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