stack package - github.com/rocketlaunchr/igo/stack - Go Packages (original) (raw)

  1. Discover Packages
  2. github.com/rocketlaunchr/igo
  3. stack

v1.0.3 Published: Apr 6, 2020 License: MIT

Imports: 2

Imported by: 0

Documentation

This section is empty.

This section is empty.

This section is empty.

Stack is used to stores closures in order.

func NewStack(lifo bool, capacity ...int) *Stack

NewStack creates a new Stack. lifo will make the stack operate in "LIFO" mode. Otherwise it will operate in "FIFO" mode. For fordefer, LIFO is required.

func (s *Stack) Add(goroutine bool, fn interface{})

Add inserts a closure to the stack.

Unwind executes all stored closures from the beginning to the end.