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

Unified Diff: src/pkg/net/fd_windows.go

Issue 6852105: code review 6852105: undo CL 6855110 / 869253ef7009 (Closed)
Patch Set: diff -r 869253ef7009 https://code.google.com/p/go Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/net/fd_unix.go ('k') | src/pkg/net/sendfile_freebsd.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/net/fd_windows.go
===================================================================
--- a/src/pkg/net/fd_windows.go
+++ b/src/pkg/net/fd_windows.go
@@ -285,39 +285,11 @@
errnoc [2]chan error // read/write submit or cancel operation errors
closec chan bool // used by Close to cancel pending IO
- // serialize access to Read and Write methods
- rio, wio sync.Mutex
-
- // read and write deadlines
- rdeadline, wdeadline deadline
-}
-
-// deadline is a number of nanoseconds since 1970 or 0, if no deadline is set.
-// For compatability, deadline has the same method set as fd_unix.go, but
-// does not use atomic operations as it is not known if data races exist on
-// these values.
-// TODO(dfc,brainman) when we get a windows race builder, revisit this.
-type deadline int64
-
-func (d *deadline) expired() bool {
- t := d.value()
- return t > 0 && time.Now().UnixNano() >= t
-}
-
-func (d *deadline) value() int64 {
- return int64(*d)
-}
-
-func (d *deadline) set(v int64) {
- *d = deadline(v)
-}
-
-func (d *deadline) setTime(t time.Time) {
- if t.IsZero() {
- d.set(0)
- } else {
- d.set(t.UnixNano())
- }
+ // owned by client
+ rdeadline int64
+ rio sync.Mutex
+ wdeadline int64
+ wio sync.Mutex
}
func allocFD(fd syscall.Handle, family, sotype int, net string) *netFD {
@@ -450,7 +422,7 @@
defer fd.rio.Unlock()
var o readOp
o.Init(fd, buf, 'r')
- n, err := iosrv.ExecIO(&o, fd.rdeadline.value())
+ n, err := iosrv.ExecIO(&o, fd.rdeadline)
if err == nil && n == 0 {
err = io.EOF
}
@@ -487,7 +459,7 @@
var o readFromOp
o.Init(fd, buf, 'r')
o.rsan = int32(unsafe.Sizeof(o.rsa))
- n, err = iosrv.ExecIO(&o, fd.rdeadline.value())
+ n, err = iosrv.ExecIO(&o, fd.rdeadline)
if err != nil {
return 0, nil, err
}
@@ -519,7 +491,7 @@
defer fd.wio.Unlock()
var o writeOp
o.Init(fd, buf, 'w')
- return iosrv.ExecIO(&o, fd.wdeadline.value())
+ return iosrv.ExecIO(&o, fd.wdeadline)
}
// WriteTo to network.
@@ -551,7 +523,7 @@
var o writeToOp
o.Init(fd, buf, 'w')
o.sa = sa
- return iosrv.ExecIO(&o, fd.wdeadline.value())
+ return iosrv.ExecIO(&o, fd.wdeadline)
}
// Accept new network connections.
@@ -600,7 +572,7 @@
var o acceptOp
o.Init(fd, 'r')
o.newsock = s
- _, err = iosrv.ExecIO(&o, fd.rdeadline.value())
+ _, err = iosrv.ExecIO(&o, fd.rdeadline)
if err != nil {
closesocket(s)
return nil, err
« no previous file with comments | « src/pkg/net/fd_unix.go ('k') | src/pkg/net/sendfile_freebsd.go » ('j') | no next file with comments »

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