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

Issue 168041: code review 168041: Make the operations on the global rng thread safe. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by rog
Modified:
14 years, 4 months ago
Reviewers:
CC:
r, rsc, golang-dev
Visibility:
Public.

Description

Make the operations on the global rng thread safe.

Patch Set 1 #

Patch Set 2 : code review 168041: Provide a function, ThreadSafe, to allow any pseudo-ran... #

Total comments: 3

Patch Set 3 : code review 168041: Make the operations on the global rng thread safe. #

Patch Set 4 : code review 168041: Make the operations on the global rng thread safe. #

Patch Set 5 : code review 168041: Make the operations on the global rng thread safe. #

Total comments: 1

Patch Set 6 : code review 168041: Make the operations on the global rng thread safe. #

Patch Set 7 : code review 168041: Make the operations on the global rng thread safe. #

Patch Set 8 : code review 168041: Make the operations on the global rng thread safe. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -1 line) Patch
M src/pkg/rand/rand.go View 3 4 5 6 3 chunks +21 lines, -1 line 0 comments Download
M src/pkg/rand/rand_test.go View 1 chunk +33 lines, -0 lines 0 comments Download

Messages

Total messages: 17
rog
Hello r, rsc (cc: golang-dev@googlegroups.com), I'd like you to review the following change.
14 years, 4 months ago (2009-12-09 13:48:27 UTC) #1
r
http://codereview.appspot.com/168041/diff/1003/1005 File src/pkg/rand/ts.go (right): http://codereview.appspot.com/168041/diff/1003/1005#newcode25 src/pkg/rand/ts.go:25: tssrc := tssource{make(chan int64), make(chan int64)}; these should certainly ...
14 years, 4 months ago (2009-12-09 17:59:50 UTC) #2
rsc
I'm not convinced about this. I think it's a bug that the top-level functions aren't ...
14 years, 4 months ago (2009-12-09 18:11:16 UTC) #3
r2
On Dec 9, 2009, at 10:11 AM, Russ Cox wrote: > I'm not convinced about ...
14 years, 4 months ago (2009-12-09 18:21:04 UTC) #4
rog
2009/12/9 Russ Cox <rsc@golang.org>: > My counterproposal would be to put a lock in > ...
14 years, 4 months ago (2009-12-09 18:21:30 UTC) #5
rsc
My proposal was that the top-level funcs are locked (safe) but that the methods on ...
14 years, 4 months ago (2009-12-09 18:31:01 UTC) #6
rog
http://codereview.appspot.com/168041/diff/1003/1005 File src/pkg/rand/ts.go (right): http://codereview.appspot.com/168041/diff/1003/1005#newcode25 src/pkg/rand/ts.go:25: tssrc := tssource{make(chan int64), make(chan int64)}; On 2009/12/09 17:59:51, ...
14 years, 4 months ago (2009-12-09 18:44:21 UTC) #7
rog
Hello r, rsc (cc: golang-dev@googlegroups.com), I'd like you to review the following change.
14 years, 4 months ago (2009-12-09 18:52:36 UTC) #8
rog
2009/12/9 Russ Cox <rsc@golang.org>: > My proposal was that the top-level funcs are locked (safe) ...
14 years, 4 months ago (2009-12-09 18:55:58 UTC) #9
rog
after some brief testing, it appears that the mutex-based version is about 100x faster than ...
14 years, 4 months ago (2009-12-09 19:19:14 UTC) #10
rsc
looks pretty good, thanks. http://codereview.appspot.com/168041/diff/2006/16 File src/pkg/rand/rand.go (right): http://codereview.appspot.com/168041/diff/2006/16#newcode154 src/pkg/rand/rand.go:154: type tssource struct { i ...
14 years, 4 months ago (2009-12-09 19:26:38 UTC) #11
rog
2009/12/9 <rsc@golang.org>: > type lockedSource struct { > lk Lock; > src Source; > } ...
14 years, 4 months ago (2009-12-09 19:57:06 UTC) #12
rog
FWIW, i get 90ns per rand.Int32(), compared to 26.2ns for the thread-unsafe version. 2009/12/9 roger ...
14 years, 4 months ago (2009-12-09 20:12:30 UTC) #13
r2
On Dec 9, 2009, at 11:56 AM, roger peppe wrote: > 2009/12/9 <rsc@golang.org>: >> type ...
14 years, 4 months ago (2009-12-09 20:29:23 UTC) #14
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=4a235a08b490 *** Make the operations on the global rng thread safe. R=r, ...
14 years, 4 months ago (2009-12-09 20:55:21 UTC) #15
rog
2009/12/9 Rob 'Commander' Pike <r@google.com>: > that means you have benchmarks. please add them to ...
14 years, 4 months ago (2009-12-09 21:09:25 UTC) #16
rsc
14 years, 4 months ago (2009-12-09 21:14:01 UTC) #17
> done. although does it need a new issue now that russ has submitted it?

yes, sorry.
please run "hg sync", which will
close your current issue, and
then you can create a new one.
Sign in to reply to this message.

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