stack

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Stack is used to stores closures in order.

func NewStack

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 (*Stack) Add

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

Add inserts a closure to the stack.

func (*Stack) Unwind

func (s *Stack) Unwind()

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

Jump to

Keyboard shortcuts

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