2018-07-04 13:51:47 +03: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 09:24:20 +02:00
|
|
|
return WithProcessClosing(context.Background(), p)
|
2018-07-04 13:51:47 +03: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 09:24:20 +02:00
|
|
|
return WithProcessClosed(context.Background(), p)
|
2018-07-04 13:51:47 +03:00
|
|
|
}
|