terminator

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 5 Imported by: 3

README

Go Reference Go Report Card

terminator

import "github.com/bruceesmith/terminator"

Package terminator permits orderly stopping / shutdown of a group of goroutines via methods which mimic stop of a sync.WaitGroup.There is a default Terminator accessible through top level functions (Add, Done, Wait and so on) that call the corresponding Terminator methods

Index

func Add

func Add(delta int)

Add adds delta to the count of goroutines in the group

func Done

func Done()

Done decrements the count of goroutines in the group by one

func Go

func Go(f func())

Go runs a function inside an Add(1) --- Done() sequence

func SetDefault

func SetDefault(t *Terminator)

SetDefault sets the default Terminator

func ShutDown

func ShutDown() <-chan struct{}

ShutDown allows code to wait for a shut down signal

func ShuttingDown

func ShuttingDown() bool

ShuttingDown returns true if shutdown is in progress

func Stop

func Stop()

Stop signals that all goroutines in the group should safely exit

func Wait

func Wait()

Wait blocks until every goroutines in the group has called Done()

type Terminator

Terminator manages groups of goroutines

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

func Default
func Default() *Terminator

Default returns the default Terminator.

func New
func New() *Terminator

New returns a Terminator

func (*Terminator) Add
func (t *Terminator) Add(delta int)

Add adds delta to the count of goroutines in the group

func (*Terminator) Done
func (t *Terminator) Done()

Done decrements the count of goroutines in the group by one

func (*Terminator) Go
func (t *Terminator) Go(f func())

Go runs a function inside an Add(1) --- Done() sequence

func (*Terminator) ShutDown
func (t *Terminator) ShutDown() <-chan struct{}

ShutDown allows code to wait for a shut down signal

func (*Terminator) ShuttingDown
func (t *Terminator) ShuttingDown() bool

ShuttingDown returns true if shutdown is in Default().progress

func (*Terminator) Stop
func (t *Terminator) Stop()

Stop signals that all goroutines in the group should safely exit

func (*Terminator) Wait
func (t *Terminator) Wait()

Wait blocks until every goroutines in the group has called Done()

Generated by gomarkdoc

Documentation

Overview

Package terminator permits orderly stopping / shutdown of a group of goroutines via methods which mimic stop of a sync.WaitGroup.There is a default Terminator accessible through top level functions (Add, Done, Wait and so on) that call the corresponding Terminator methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(delta int)

Add adds delta to the count of goroutines in the group

func Done

func Done()

Done decrements the count of goroutines in the group by one

func Go added in v1.1.0

func Go(f func())

Go runs a function inside an Add(1) --- Done() sequence

func SetDefault

func SetDefault(t *Terminator)

SetDefault sets the default Terminator

func ShutDown

func ShutDown() <-chan struct{}

ShutDown allows code to wait for a shut down signal

func ShuttingDown

func ShuttingDown() bool

ShuttingDown returns true if shutdown is in progress

func Stop

func Stop()

Stop signals that all goroutines in the group should safely exit

func Wait

func Wait()

Wait blocks until every goroutines in the group has called Done()

Types

type Terminator

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

Terminator manages groups of goroutines

func Default

func Default() *Terminator

Default returns the default Terminator.

func New

func New() *Terminator

New returns a Terminator

func (*Terminator) Add

func (t *Terminator) Add(delta int)

Add adds delta to the count of goroutines in the group

func (*Terminator) Done

func (t *Terminator) Done()

Done decrements the count of goroutines in the group by one

func (*Terminator) Go added in v1.1.0

func (t *Terminator) Go(f func())

Go runs a function inside an Add(1) --- Done() sequence

func (*Terminator) ShutDown

func (t *Terminator) ShutDown() <-chan struct{}

ShutDown allows code to wait for a shut down signal

func (*Terminator) ShuttingDown

func (t *Terminator) ShuttingDown() bool

ShuttingDown returns true if shutdown is in Default().progress

func (*Terminator) Stop

func (t *Terminator) Stop()

Stop signals that all goroutines in the group should safely exit

func (*Terminator) Wait

func (t *Terminator) Wait()

Wait blocks until every goroutines in the group has called Done()

Jump to

Keyboard shortcuts

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