Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrimReaper ¶
type GrimReaper interface { // New creates a sub-reaper which is attached to the parent context. If // the parent context is killed, so are the children. However, Wait must // still be called for child reapers. New() GrimReaper // SpawnFunc starts a new goroutine for the given function. The task should // return as soon as possible after the context completes. SpawnFunc(TaskFunc) // Spawn starts a new goroutine for the given Task. The task should // return as soon as possible after the context completes. Spawn(Task) // Kill sends a message to all running tasks to stop. If child reapers // have also been created, they will be triggered to stop as well. Kill() // Wait will block until all tasks have completed. This will NOT block // until chlid reapers are finished. Each reaper must call wait // independently. Wait() // Dead returns the underlying net.Context done channel. Dead() <-chan struct{} }
GrimReaper is a task runner which will wait until all the tasks are complete until continuing. Reapers can also kill tasks prematurely if they are listening to the given context.
func Reaper ¶
func Reaper() GrimReaper
Reaper returns an implementation of the GrimReaper interface.
func ReaperWithContext ¶
func ReaperWithContext(c context.Context) GrimReaper
ReaperWithContext creates a new GrimReaper implementation and uses the given context as the parent context.
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
Click to show internal directories.
Click to hide internal directories.