Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWithTimeout ¶
NewWithTimeout creates a new context with a timeout and runs the given function with the context. It returns an error if the function returns an error or if the context times out.
Types ¶
type TimeoutedFunc ¶
TimeoutedFunc is a function that takes a context and returns an error. It is used to run a function with a timeout.
type WaitFunc ¶
type WaitFunc func() error
WaitFunc is a function that waits for the context to be done. It is used to wait for the context to be done before returning.
func New ¶
func New(ctx context.Context, d time.Duration) (context.Context, chan error, context.CancelFunc, WaitFunc)
New creates a new context with a timeout and returns a channel to send the result and a function to cancel the context. It also returns a function that waits for the context to be done before returning.
Click to show internal directories.
Click to hide internal directories.