Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(581)

Issue 116400043: code review 116400043: go.net/context: split the implementations of Background... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by Sameer Ajmani
Modified:
10 years, 8 months ago
Reviewers:
bcmills
CC:
crawshaw, adonovan, golang-codereviews, rsc
Visibility:
Public.

Description

go.net/context: split the implementations of Background, WithValue, 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.

Patch Set 1 #

Patch Set 2 : diff -r b8982ab27ed9 https://code.google.com/p/go.net #

Patch Set 3 : diff -r b8982ab27ed9 https://code.google.com/p/go.net #

Total comments: 16

Patch Set 4 : diff -r b8982ab27ed9 https://code.google.com/p/go.net #

Patch Set 5 : diff -r b8982ab27ed9 https://code.google.com/p/go.net #

Total comments: 2

Patch Set 6 : diff -r b8982ab27ed9 https://code.google.com/p/go.net #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+275 lines, -233 lines) Patch
M context/context.go View 10 chunks +185 lines, -153 lines 1 comment Download
M context/context_test.go View 11 chunks +90 lines, -80 lines 0 comments Download

Messages

Total messages: 9
Sameer Ajmani
Hello bcmills@google.com, crawshaw@golang.org (cc: adonovan, golang-codereviews@googlegroups.com, rsc), I'd like you to review this change to ...
10 years, 8 months ago (2014-07-29 20:19:56 UTC) #1
bcmills
context.go only so far. https://codereview.appspot.com/116400043/diff/40001/context/context.go File context/context.go (right): https://codereview.appspot.com/116400043/diff/40001/context/context.go#newcode145 context/context.go:145: type emptyCtx int "type emptyCtx ...
10 years, 8 months ago (2014-07-29 21:35:00 UTC) #2
bcmills
Test LGTM. https://codereview.appspot.com/116400043/diff/40001/context/context_test.go File context/context_test.go (right): https://codereview.appspot.com/116400043/diff/40001/context/context_test.go#newcode112 context/context_test.go:112: // The parent's children should contain the ...
10 years, 8 months ago (2014-07-29 22:14:55 UTC) #3
Sameer Ajmani
https://codereview.appspot.com/116400043/diff/40001/context/context.go File context/context.go (right): https://codereview.appspot.com/116400043/diff/40001/context/context.go#newcode145 context/context.go:145: type emptyCtx int On 2014/07/29 21:35:00, bcmills wrote: > ...
10 years, 8 months ago (2014-07-30 14:43:30 UTC) #4
Sameer Ajmani
https://codereview.appspot.com/116400043/diff/40001/context/context_test.go File context/context_test.go (right): https://codereview.appspot.com/116400043/diff/40001/context/context_test.go#newcode352 context/context_test.go:352: limit: 1, On 2014/07/29 22:14:55, bcmills wrote: > Nice! ...
10 years, 8 months ago (2014-07-30 14:53:16 UTC) #5
bcmills
LGTM. https://codereview.appspot.com/116400043/diff/80001/context/context.go File context/context.go (right): https://codereview.appspot.com/116400043/diff/80001/context/context.go#newcode347 context/context.go:347: propagateCancel(parent, c) Moving the propagateCancel call to here ...
10 years, 8 months ago (2014-07-30 15:44:26 UTC) #6
Sameer Ajmani
https://codereview.appspot.com/116400043/diff/80001/context/context.go File context/context.go (right): https://codereview.appspot.com/116400043/diff/80001/context/context.go#newcode347 context/context.go:347: propagateCancel(parent, c) On 2014/07/30 15:44:26, bcmills wrote: > Moving ...
10 years, 8 months ago (2014-07-30 16:14:44 UTC) #7
Sameer Ajmani
*** Submitted as https://code.google.com/p/go/source/detail?r=0790d591105b&repo=net *** go.net/context: split the implementations of Background, WithValue, WithCancel, and WithTimeout ...
10 years, 8 months ago (2014-07-30 16:15:01 UTC) #8
bcmills
10 years, 8 months ago (2014-07-30 16:19:56 UTC) #9
Message was sent while issue was closed.
https://codereview.appspot.com/116400043/diff/100001/context/context.go
File context/context.go (right):

https://codereview.appspot.com/116400043/diff/100001/context/context.go#newco...
context/context.go:345: c.cancel(false, DeadlineExceeded) // deadline has
already passed
With propagateCancel back before this call, I think we want
removeFromParent=true here to avoid a tiny leak.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b