mirror of
https://github.com/golang/go
synced 2024-11-17 04:14:52 -07:00
context: update doc comment to link to context interface
Linking to the Context interface in the WithCancel doc comment makes it more consistent with the WithDeadline and WithTimeout doc comments.
This commit is contained in:
parent
e41fabd688
commit
9c6bb607a9
@ -231,7 +231,7 @@ type CancelFunc func()
|
|||||||
// or when the parent context's Done channel is closed, whichever happens first.
|
// or when the parent context's Done channel is closed, whichever happens first.
|
||||||
//
|
//
|
||||||
// Canceling this context releases resources associated with it, so code should
|
// Canceling this context releases resources associated with it, so code should
|
||||||
// call cancel as soon as the operations running in this Context complete.
|
// call cancel as soon as the operations running in this [Context] complete.
|
||||||
func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
|
func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
|
||||||
c := withCancel(parent)
|
c := withCancel(parent)
|
||||||
return c, func() { c.cancel(true, Canceled, nil) }
|
return c, func() { c.cancel(true, Canceled, nil) }
|
||||||
|
Loading…
Reference in New Issue
Block a user