Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockFreeStack ¶
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 ¶
func NewLockFreeStack[T any]() *LockFreeStack[T]
NewLockFreeStack creates a new lock-free queue.
func (*LockFreeStack[T]) Len ¶
func (s *LockFreeStack[T]) Len() uint64
func (*LockFreeStack[T]) Pop ¶
func (s *LockFreeStack[T]) Pop() (T, bool)
Pop pops value from the top of the stack.
func (*LockFreeStack[T]) Push ¶
func (s *LockFreeStack[T]) Push(v T)
Push pushes a value on top of the stack.
type MutexStack ¶
type MutexStack[T any] struct { // contains filtered or unexported fields }
func NewMutexStack ¶
func NewMutexStack[T any]() *MutexStack[T]
func (*MutexStack[T]) Pop ¶
func (s *MutexStack[T]) Pop() (T, bool)
func (*MutexStack[T]) Push ¶
func (s *MutexStack[T]) Push(v T)
Click to show internal directories.
Click to hide internal directories.