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

Side by Side Diff: src/pkg/net/fd_poll_unix.go

Issue 8670044: code review 8670044: net: implement netpoll for windows (Closed)
Patch Set: diff -r 0c9561ddf631 https://go.googlecode.com/hg/ Created 10 years, 11 months ago
Left:
Right:
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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Go Authors. All rights reserved. 1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build freebsd netbsd openbsd 5 // +build freebsd netbsd openbsd
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "os" 10 "os"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 func (pd *pollDesc) Evict() bool { 296 func (pd *pollDesc) Evict() bool {
297 return pd.pollServer.Evict(pd) 297 return pd.pollServer.Evict(pd)
298 } 298 }
299 299
300 // Spread network FDs over several pollServers. 300 // Spread network FDs over several pollServers.
301 301
302 var pollMaxN int 302 var pollMaxN int
303 var pollservers []*pollServer 303 var pollservers []*pollServer
304 var startServersOnce []func() 304 var startServersOnce []func()
305 305
306 var canCancelIO = true // used for testing current package 306 func init() {
dvyukov 2013/05/19 15:15:48 I thought there are some initialization dependency
brainman 2013/05/20 02:12:45 sysInit is still needed for windows, but you code
307
308 func sysInit() {
309 pollMaxN = runtime.NumCPU() 307 pollMaxN = runtime.NumCPU()
310 if pollMaxN > 8 { 308 if pollMaxN > 8 {
311 pollMaxN = 8 // No improvement then. 309 pollMaxN = 8 // No improvement then.
312 } 310 }
313 pollservers = make([]*pollServer, pollMaxN) 311 pollservers = make([]*pollServer, pollMaxN)
314 startServersOnce = make([]func(), pollMaxN) 312 startServersOnce = make([]func(), pollMaxN)
315 for i := 0; i < pollMaxN; i++ { 313 for i := 0; i < pollMaxN; i++ {
316 k := i 314 k := i
317 once := new(sync.Once) 315 once := new(sync.Once)
318 startServersOnce[i] = func() { once.Do(func() { startServer(k) } ) } 316 startServersOnce[i] = func() { once.Do(func() { startServer(k) } ) }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 func setWriteDeadline(fd *netFD, t time.Time) error { 349 func setWriteDeadline(fd *netFD, t time.Time) error {
352 fd.pd.wdeadline.setTime(t) 350 fd.pd.wdeadline.setTime(t)
353 return nil 351 return nil
354 } 352 }
355 353
356 func setDeadline(fd *netFD, t time.Time) error { 354 func setDeadline(fd *netFD, t time.Time) error {
357 setReadDeadline(fd, t) 355 setReadDeadline(fd, t)
358 setWriteDeadline(fd, t) 356 setWriteDeadline(fd, t)
359 return nil 357 return nil
360 } 358 }
OLDNEW

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