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

Issue 6641050: code review 6641050: io/ioutil: fix data race on rand (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by dvyukov
Modified:
11 years, 5 months ago
Reviewers:
dfc
CC:
golang-dev, rsc
Visibility:
Public.

Description

io/ioutil: fix data race on rand Fixes issue 4212.

Patch Set 1 #

Patch Set 2 : diff -r ba847b110365 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r ba847b110365 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 4 : diff -r c58647359c01 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M src/pkg/io/ioutil/tempfile.go View 1 2 chunks +4 lines, -0 lines 5 comments Download

Messages

Total messages: 4
dvyukov
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
11 years, 5 months ago (2012-10-09 17:00:45 UTC) #1
rsc
LGTM
11 years, 5 months ago (2012-10-09 17:02:20 UTC) #2
dvyukov
*** Submitted as http://code.google.com/p/go/source/detail?r=6976c7f91270 *** io/ioutil: fix data race on rand Fixes issue 4212. R=golang-dev, ...
11 years, 5 months ago (2012-10-09 17:09:09 UTC) #3
dfc
11 years, 5 months ago (2012-10-09 23:53:16 UTC) #4
Just a suggestion.

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.go
File src/pkg/io/ioutil/tempfile.go (right):

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.g...
src/pkg/io/ioutil/tempfile.go:20: var randmu sync.Mutex
I would like to see this as

var rand = struct {
    value uint32
    sync.Mutex
}{}

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.g...
src/pkg/io/ioutil/tempfile.go:27: randmu.Lock()
rand.Lock()

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.g...
src/pkg/io/ioutil/tempfile.go:28: r := rand
r := rand.value

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.g...
src/pkg/io/ioutil/tempfile.go:33: rand = r
rand.value = r

https://codereview.appspot.com/6641050/diff/3002/src/pkg/io/ioutil/tempfile.g...
src/pkg/io/ioutil/tempfile.go:34: randmu.Unlock()
rand.Unlock()
Sign in to reply to this message.

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