Documentation ¶
Index ¶
- Variables
- func Error(ctx context.Context) error
- func ShrinkDeadline(ctx context.Context, dur time.Duration) time.Time
- func Signal(signals ...os.Signal) (context.Context, context.CancelFunc)
- func SignalCause(signals ...os.Signal) (context.Context, context.CancelCauseFunc)
- func WithSignal(ctx context.Context, signals ...os.Signal) (context.Context, context.CancelFunc)
- func WithSignalCause(ctx context.Context, signals ...os.Signal) (context.Context, context.CancelCauseFunc)
- func WithoutCancel(parent context.Context) context.Context
- type SignalError
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ShrinkDeadline ¶
ShrinkDeadline calculates a new deadline based on the given duration `dur` and context `ctx`. If no deadline is set in `ctx`, it returns the current time plus `dur`. If a deadline is set in `ctx`, it returns the earlier of the two deadlines.
func SignalCause ¶
SignalCause creates a new context that cancels on the given signals.
func WithSignal ¶
WithSignal like signal.NotifyContext.
func WithSignalCause ¶
func WithoutCancel ¶
WithoutCancel returns a copy of parent that is not canceled when parent is canceled. The returned context returns no Deadline or Err, and its Done channel is nil. Calling [Cause] on the returned context returns nil. copy from go1.21 "context"
Types ¶
type SignalError ¶
func (SignalError) Error ¶
func (e SignalError) Error() string
Click to show internal directories.
Click to hide internal directories.