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

Issue 4968079: code review 4968079: os: Remove file lock on Windows

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by jp
Modified:
5 years, 1 month ago
Reviewers:
Visibility:
Public.

Description

os: Remove file lock on Windows This lock has been introduced as a fix to emulate Linux' Pread semantic on Windows (see http://codereview.appspot.com/4415041/). On Linux Pread and Pwrite do not change the current file position but on Windows do. To emulate Linux semantic, Pread on Windows was implemented as the sequence of Lock, GetFilePos, Read, Seek, Unlock. This patch solves the problem in a lightweight way, storing a fake file pointer inside File structure. ReadAt() and WriteAt() can be called from different threads in parallel. Also, with this patch, all the file reads and writes became overlapped, making it easy to wait for their completion in a non-blocking way (as it is done with sockets). The same IOCP loop can be shared for sockets and files.

Patch Set 1 #

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+113 lines, -42 lines) Patch
M src/pkg/os/file_windows.go View 1 6 chunks +42 lines, -40 lines 0 comments Download
M src/pkg/os/os_test.go View 1 4 chunks +22 lines, -0 lines 0 comments Download
M src/pkg/syscall/syscall_windows.go View 1 2 chunks +4 lines, -0 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_386.go View 1 2 chunks +21 lines, -0 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_amd64.go View 1 2 chunks +21 lines, -0 lines 0 comments Download
M src/pkg/syscall/ztypes_windows.go View 1 3 chunks +3 lines, -2 lines 0 comments Download

Messages

Total messages: 15
jp
Hello golang-dev@googlegroups.com (cc: alex.brainman@gmail.com, golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 7 months ago (2011-09-08 19:03:16 UTC) #1
rsc
Seems unlikely to play nicely with the rest of the operating system. Suppose you build ...
12 years, 7 months ago (2011-09-08 19:07:21 UTC) #2
jp
On 2011/09/08 19:07:21, rsc wrote: > You could paper over that by sniffing the file ...
12 years, 7 months ago (2011-09-08 19:30:24 UTC) #3
brainman
On 2011/09/08 19:30:24, jp wrote: > > Is it practical to pass the file handles ...
12 years, 7 months ago (2011-09-09 02:16:43 UTC) #4
jp
On 2011/09/09 02:16:43, brainman wrote: > On 2011/09/08 19:30:24, jp wrote: > > > > ...
12 years, 7 months ago (2011-09-09 03:08:09 UTC) #5
brainman
On 2011/09/09 03:08:09, jp wrote: > > Looks like you blame me that I introduce ...
12 years, 7 months ago (2011-09-09 03:30:12 UTC) #6
jp
On 2011/09/09 03:30:12, brainman wrote: > For example, existing Read and Write functions are safe ...
12 years, 7 months ago (2011-09-09 11:57:43 UTC) #7
jp
On 2011/09/09 02:16:43, brainman wrote: > > 1. One opinion: > > > http://groups.google.com/group/golang-dev/browse_thread/thread/92ebe2285855d5c4/02415a2fb1afde49 > ...
12 years, 7 months ago (2011-09-09 12:14:37 UTC) #8
brainman
On 2011/09/09 11:57:43, jp wrote: > > It does not hamper to move towards the ...
12 years, 7 months ago (2011-09-11 08:30:46 UTC) #9
brainman
On 2011/09/09 12:14:37, jp wrote: > The lock does not allow to Write to the ...
12 years, 7 months ago (2011-09-11 08:32:36 UTC) #10
jp
On 2011/09/11 08:32:36, brainman wrote: > On 2011/09/09 12:14:37, jp wrote: > > The lock ...
12 years, 7 months ago (2011-09-11 08:57:17 UTC) #11
brainman
On 2011/09/11 08:57:17, jp wrote: > > > > If you use serial port or ...
12 years, 7 months ago (2011-09-12 01:03:09 UTC) #12
jp
On 2011/09/12 01:03:09, brainman wrote: > On 2011/09/11 08:57:17, jp wrote: > > > > ...
12 years, 7 months ago (2011-09-12 09:54:19 UTC) #13
brainman
On 2011/09/12 09:54:19, jp wrote: > > 3) you can't "listen" on files; > not ...
12 years, 7 months ago (2011-09-12 11:23:02 UTC) #14
rsc
11 years, 11 months ago (2012-06-03 04:31:45 UTC) #15
removing reviewers
Sign in to reply to this message.

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