2018-07-04 10:51:47 +00:00
|
|
|
package goprocessctx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
goprocess "github.com/jbenet/goprocess"
|
|
|
|
)
|
|
|
|
|
|
|
|
// OnClosingContext derives a context from a given goprocess that will
|
|
|
|
// be 'Done' when the process is closing
|
|
|
|
func OnClosingContext(p goprocess.Process) context.Context {
|
2019-06-09 07:24:20 +00:00
|
|
|
return WithProcessClosing(context.Background(), p)
|
2018-07-04 10:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OnClosedContext derives a context from a given goprocess that will
|
|
|
|
// be 'Done' when the process is closed
|
|
|
|
func OnClosedContext(p goprocess.Process) context.Context {
|
2019-06-09 07:24:20 +00:00
|
|
|
return WithProcessClosed(context.Background(), p)
|
2018-07-04 10:51:47 +00:00
|
|
|
}
|