Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockFreeStack ¶ added in v0.3.0
type LockFreeStack[T any] struct { // contains filtered or unexported fields }
LockFreeStack implements lock-free freelist based stack.
Example ¶
s := NewLockFreeStack[int]() s.Push(1) s.Push(2) s.Push(3) fmt.Println(s.Pop()) fmt.Println(s.Pop()) fmt.Println(s.Pop())
Output: 3 true 2 true 1 true
func NewLockFreeStack ¶ added in v0.3.0
func NewLockFreeStack[T any]() *LockFreeStack[T]
NewLockFreeStack creates a new lock-free queue.
func (*LockFreeStack[T]) Len ¶ added in v0.10.8
func (s *LockFreeStack[T]) Len() uint64
func (*LockFreeStack[T]) Pop ¶ added in v0.3.0
func (s *LockFreeStack[T]) Pop() (T, bool)
Pop pops value from the top of the stack.
func (*LockFreeStack[T]) Push ¶ added in v0.3.0
func (s *LockFreeStack[T]) Push(v T)
Push pushes a value on top of the stack.
type MutexStack ¶ added in v0.10.8
type MutexStack[T any] struct { // contains filtered or unexported fields }
func NewMutexStack ¶ added in v0.10.8
func NewMutexStack[T any]() *MutexStack[T]
func (*MutexStack[T]) Pop ¶ added in v0.10.8
func (s *MutexStack[T]) Pop() (T, bool)
func (*MutexStack[T]) Push ¶ added in v0.10.8
func (s *MutexStack[T]) Push(v T)
Click to show internal directories.
Click to hide internal directories.