jobs

package
v0.0.0-...-0939e29 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSignals

func InitSignals() context.Context

func InitiateShutdown

func InitiateShutdown()

func LogSignalAndStop

func LogSignalAndStop()

func ShutdownWait

func ShutdownWait(allJobs ...*RunningJob)

Assumes WaitUntilSignal finished therefore all jobs already started their shutdown.

func Sleep

func Sleep(ctx context.Context, delay time.Duration)

Sleep is like time.Sleep, but responds to context cancellation

func StopIfCanceled

func StopIfCanceled()

func WaitAll

func WaitAll(finishCTX context.Context, allJobs ...*RunningJob)

func WaitUntilSignal

func WaitUntilSignal()

Types

type JobForTests

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

func StartForTests

func StartForTests(job func(context.Context)) JobForTests

For the convenience of tests creates a context underneath.

func (JobForTests) Quit

func (q JobForTests) Quit()

type NamedFunction

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

func EmptyJob

func EmptyJob() NamedFunction

func Later

func Later(name string, job func()) NamedFunction

func (NamedFunction) Start

func (nf NamedFunction) Start() *RunningJob

type RunningJob

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

func Start

func Start(name string, job func()) RunningJob

func (*RunningJob) MustWait

func (q *RunningJob) MustWait()

func (*RunningJob) Wait

func (q *RunningJob) Wait(finishCTX context.Context) error

Jump to

Keyboard shortcuts

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