routine

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(logger hclog.Logger) *Manager

func (*Manager) IsRunning

func (m *Manager) IsRunning(name string) bool

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, name string, routine Routine) error

func (*Manager) Stop

func (m *Manager) Stop(name string) <-chan struct{}

Caveat: The returned stoppedCh indicates that the routine is completed

It's possible that ctx is canceled, but stoppedCh not yet closed
Use mgr.IsRunning(name) than this stoppedCh to tell whether the
instance is still running (not cancelled or completed).

func (*Manager) StopAll

func (m *Manager) StopAll()

StopAll goroutines. Once StopAll is called, it is no longer safe to add no goroutines to the Manager.

func (*Manager) Wait added in v1.10.7

func (m *Manager) Wait()

Wait for all goroutines to stop after StopAll is called.

type Routine

type Routine func(ctx context.Context) error

Jump to

Keyboard shortcuts

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