Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForContext ¶
WaitForContext makes p WaitFor ctx. When Closing, p waits for ctx.Done(), before being Closed(). It is simply:
p.WaitFor(goprocess.WithContext(ctx))
func WithContext ¶
WithContext constructs and returns a Process that respects given context. It is the equivalent of:
func ProcessWithContext(ctx context.Context) goprocess.Process { p := goprocess.WithParent(goprocess.Background()) go func() { <-ctx.Done() p.Close() }() return p }
func WithProcessClosed ¶
WithProcessClosed returns a context.Context that is cancelled after Process p is Closed. It is the equivalent of:
func WithProcessClosed(ctx context.Context, p goprocess.Process) context.Context { ctx, cancel := context.WithCancel(ctx) go func() { <-p.Closed() cancel() }() return ctx }
func WithProcessClosing ¶
WithProcessClosing returns a context.Context derived from ctx that is cancelled as p is Closing (after: <-p.Closing()). It is simply:
func WithProcessClosing(ctx context.Context, p goprocess.Process) context.Context { ctx, cancel := context.WithCancel(ctx) go func() { <-p.Closing() cancel() }() return ctx }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.