Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶
type Link interface {
Stop() // Stop breaks the link.
}
Link is used to temporarily link a context with a cancel function.
func NewChannelLink ¶
func NewChannelLink(c <-chan struct{}, cancel context.CancelFunc) Link
NewChannelLink will temporarily link the given channel to the given cancel function: that is, the channel firing will cause the cancel function to be called. Call Stop on the returned Link to break the link; for example:
defer NewChannelLink(doneC, cancel).Stop()
func NewLink ¶
func NewLink(ctx context.Context, cancel context.CancelFunc) Link
NewLink will temporarily link the given context to the given cancel function: that is, the context firing will cause the cancel function to be called. Call Stop on the returned Link to break the link; for example:
defer NewLink(ctx, cancel).Stop()
Click to show internal directories.
Click to hide internal directories.