Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Callback ¶
type Callback interface { // OnCancelled is called when the context is cancelled. OnCancelled(status.Status) }
Callback is called when the context is cancelled.
type CancelContext ¶
type CancelContext interface { Context // Cancel cancels the context. Cancel() }
CancelContext is a cancellable async context.
type Context ¶
type Context interface { // Done returns true if the context is cancelled. Done() bool // Wait returns a channel which is closed when the context is cancelled. Wait() <-chan struct{} // Status returns a cancellation status or OK. Status() status.Status // AddCallback adds a callback. AddCallback(c Callback) // RemoveCallback removes a callback. RemoveCallback(c Callback) // Free cancels and releases the context. Free() }
Context is an async cancellation context.
Usage:
ctx := NewContext() defer ctx.Free()
func NextDeadline ¶
NextDeadline returns a child context with a deadline.
func NextTimeout ¶
NextTimeout returns a child context with a timeout.
Click to show internal directories.
Click to hide internal directories.