NewContext provides a new context derived from the given context ctx. Normally, you will not need to call this function unless you are loading modules which have a different lifespan than the ones for the context the module was provisioned with. Be sure to call the cancel func when the context is to
(ctx Context)
| 63 | // modules which are loaded will be properly unloaded. |
| 64 | // See standard library context package's documentation. |
| 65 | func NewContext(ctx Context) (Context, context.CancelFunc) { |
| 66 | newCtx, cancelCause := NewContextWithCause(ctx) |
| 67 | return newCtx, func() { cancelCause(nil) } |
| 68 | } |
| 69 | |
| 70 | // NewContextWithCause is like NewContext but returns a context.CancelCauseFunc. |
| 71 | // EXPERIMENTAL: This API is subject to change. |