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

Issue 4415041: code review 4415041: io: clarify that ReadAt shouldn't move the seek offset (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by bradfitz
Modified:
13 years, 1 month ago
Reviewers:
brainman
CC:
r, mkrautz, r2, rsc, golang-dev
Visibility:
Public.

Description

io: clarify that ReadAt shouldn't move the seek offset

Patch Set 1 #

Patch Set 2 : diff -r 1db528dd8dc6 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 1db528dd8dc6 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 4 : diff -r 1db528dd8dc6 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 1db528dd8dc6 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M src/pkg/io/io.go View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 11
bradfitz
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 1 month ago (2011-04-13 16:46:17 UTC) #1
bradfitz
This was at least my interpretation. I always assumed ReadAt was like pread(2), which documents ...
13 years, 1 month ago (2011-04-13 16:49:54 UTC) #2
r
LGTM but let others weigh in
13 years, 1 month ago (2011-04-13 17:00:14 UTC) #3
mkrautz
On 2011/04/13 16:49:54, bradfitzgo wrote: > This was at least my interpretation. > > I ...
13 years, 1 month ago (2011-04-13 17:13:31 UTC) #4
r2
On Apr 13, 2011, at 10:13 AM, krautz@gmail.com wrote: > On 2011/04/13 16:49:54, bradfitzgo wrote: ...
13 years, 1 month ago (2011-04-13 17:17:51 UTC) #5
bradfitz
On Wed, Apr 13, 2011 at 10:13 AM, <krautz@gmail.com> wrote: > On 2011/04/13 16:49:54, bradfitzgo ...
13 years, 1 month ago (2011-04-13 17:19:29 UTC) #6
rsc
http://codereview.appspot.com/4415041/diff/4001/src/pkg/io/io.go File src/pkg/io/io.go (right): http://codereview.appspot.com/4415041/diff/4001/src/pkg/io/io.go#newcode128 src/pkg/io/io.go:128: // underlying data stream without changing the underlying seek ...
13 years, 1 month ago (2011-04-13 17:56:42 UTC) #7
bradfitz
Hello golang-dev@googlegroups.com, r, mkrautz, r2, rsc (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 1 month ago (2011-04-13 18:12:59 UTC) #8
rsc
LGTM
13 years, 1 month ago (2011-04-13 18:14:26 UTC) #9
bradfitz
*** Submitted as http://code.google.com/p/go/source/detail?r=65b2233724dd *** io: clarify that ReadAt shouldn't move the seek offset R=r, ...
13 years, 1 month ago (2011-04-13 18:18:45 UTC) #10
brainman
13 years, 1 month ago (2011-04-18 07:31:55 UTC) #11
On 2011/04/13 17:19:29, bradfitzgo wrote:
> 
> But at least it looks like Alex restores the seek offset at the end, which
> matches pread's semantics.... roughly.

There is a race there. I wasn't even sure if I should implement semantics at the
time I wrote the code.

> I believe you should be able to have one goroutine reading an io.Reader and
> another goroutine doing ReadAt calls on the same instance without races,
> though.

I would rather use lock private to each file to serialize all pread/pwrite calls
for that file. Feels too heavy for such low level function, but I see no other
alternatives at the moment. If no objections, I'll submit a patch.

> At least read and pread work like that.

Do you mean in linux/libc?

Alex
Sign in to reply to this message.

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