Documentation
¶
Index ¶
- func CheckPause(ctx context.Context) error
- type Context
- func (pc *Context) CheckPause() error
- func (pc *Context) Deadline() (deadline time.Time, ok bool)
- func (pc *Context) Done() <-chan struct{}
- func (pc *Context) Err() error
- func (pc *Context) IsPaused() bool
- func (pc *Context) Pause()
- func (pc *Context) Resume()
- func (pc *Context) Value(key interface{}) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPause ¶
CheckPause is a convenience function that checks if any context in the chain is pausable and paused
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context wraps a context.Context and allows pausing/resuming operations
func FromContext ¶
FromContext retrieves the pausable context from any context in the chain This works even if the context has been wrapped by context.WithCancel, context.WithTimeout, etc.
func NewContext ¶
NewContext creates a new pausable context that stores itself in the context chain
func (*Context) CheckPause ¶
CheckPause blocks if the context is paused until it's resumed or the parent context is canceled
func (*Context) Done ¶
func (pc *Context) Done() <-chan struct{}
Done returns a channel that's closed when the context is canceled or the parent is done
Click to show internal directories.
Click to hide internal directories.