type iface struct {
itab, data uintptr
}
type valueCtx struct {
context.Context
key, val interface{}
}
// A canceler is a context type that can be canceled directly. The
// implementations are *cancelCtx and *timerCtx.
type canceler interface {
cancel(removeFromParent bool, err error)
Done() <-chan struct{}
}
// A cancelCtx can be canceled. When canceled, it also cancels any children
// that implement canceler.
type cancelCtx struct {
context.Context
mu sync.Mutex // protects following fields
done chan struct{} // created lazily, closed by first cancel call
children map[canceler]struct{} // set to nil by the first cancel call
err error // set to non-nil by the first cancel call
}
func GetKeyValues(ctx context.Context) map[interface{}]interface{} {
m := make(map[interface{}]interface{})
getKeyValue(ctx, m)
return m
}
func getKeyValue(ctx context.Context, m map[interface{}]interface{}) {
rtType :
go context 拷贝去除 cancel 函数
最新推荐文章于 2024-04-17 09:17:11 发布