package module
Version: v0.0.0-...-000865f Latest Latest

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

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0






This section is empty.


This section is empty.


func PanicCapturingGo

func PanicCapturingGo(f func(context.Context), panicChan chan *GoroutinePanic, processWG *sync.WaitGroup, parentCtx context.Context)

replacement for "go". 1. if panicChan is not nil, captures panics in the goroutine and sends the error to the panicChan channel (optional) 2. if processWG is not nil, handles adding and removing this goroutine from the caller's processWG wait group (optional) 3. if parentCtx is not nil, creates a child ctx from it and passes it into 'f'. If 'f' panics, this will call the child ctx's cancel function to cancel anything spawned from 'f' that takes a ctx.


type Executor

type Executor interface {
	// Contract:
	// Implementation is responsible for this being a synchonous call.
	// Execute() should only return with a nil error if the process has successfully
	// started.
	// When it has returned, it is expected that the "main work" in Execute
	// is now running asynchronously.
	// Execute() should only be called once by the caller.
	// The GoroutinePanic chan is used by the caller to surface panics in spawned
	// goroutines up to the calling function.
	// All go routines spawned off within Execute (or its called functions)
	// should be wrapped in a 'PanicCapturingGo', with this panic chan passed in.
	// Any panics from a spawned go routine will automatically be recorded to the
	// channel.
	// The implementation should not touch this channel for any other purposes.
	Execute(chan *GoroutinePanic) error

	// Contract:
	// Implementation is responsible for this being a synchronous call.
	// Stop() should only send back a value on 'finishedChan' return once all resources are cleaned up.
	Stop(finishedChan chan bool)

	// Contract:
	// Cancel should try to cancel immediately. It should return quickly.
	// Cancel is used by the caller if Stop does not complete successfully

type GoroutinePanic

type GoroutinePanic struct {
	PanickedObject interface{}
	StackTrace     string


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL