• Sameer Ajmani's avatar
    go.net/context: split the implementations of Background, WithValue, · a67aa996
    Sameer Ajmani authored
    WithCancel, and WithTimeout to use different concrete types.  Update the
    tests and documentation.
    
    This change reduces the size of context structs, reduces the number of
    allocations (see TestAllocs) and removes unnecessary pointers from the
    heap, such as the timer field for non-timer contexts.
    
    IMPORTANT: I've removed the code in these functions that handles nil Context parameters.  Passing a nil parent Context will now cause a panic.
    
    LGTM=bcmills
    R=bcmills, crawshaw
    CC=adonovan, golang-codereviews, rsc
    https://golang.org/cl/116400043
    a67aa996
context_test.go 13.2 KB