mirror of
https://github.com/golang/go
synced 2024-10-01 01:18:32 -06:00
net: remove the dregs of old built-in poll server
We don't need placeholders for the old built-in poll server any more. Change-Id: I3a510aec6a30bc2ac97676c400177cdfe557b8dc Reviewed-on: https://go-review.googlesource.com/3863 Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
parent
d2abbf3ccf
commit
c768a84b38
@ -18,18 +18,11 @@ func (pd *pollDesc) Init(fd *netFD) error { pd.fd = fd; return nil }
|
|||||||
|
|
||||||
func (pd *pollDesc) Close() {}
|
func (pd *pollDesc) Close() {}
|
||||||
|
|
||||||
func (pd *pollDesc) Lock() {}
|
func (pd *pollDesc) Evict() {
|
||||||
|
|
||||||
func (pd *pollDesc) Unlock() {}
|
|
||||||
|
|
||||||
func (pd *pollDesc) Wakeup() {}
|
|
||||||
|
|
||||||
func (pd *pollDesc) Evict() bool {
|
|
||||||
pd.closing = true
|
pd.closing = true
|
||||||
if pd.fd != nil {
|
if pd.fd != nil {
|
||||||
syscall.StopIO(pd.fd.sysfd)
|
syscall.StopIO(pd.fd.sysfd)
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pd *pollDesc) Prepare(mode int) error {
|
func (pd *pollDesc) Prepare(mode int) error {
|
||||||
|
@ -48,23 +48,12 @@ func (pd *pollDesc) Close() {
|
|||||||
pd.runtimeCtx = 0
|
pd.runtimeCtx = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pd *pollDesc) Lock() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pd *pollDesc) Unlock() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pd *pollDesc) Wakeup() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evict evicts fd from the pending list, unblocking any I/O running on fd.
|
// Evict evicts fd from the pending list, unblocking any I/O running on fd.
|
||||||
// Return value is whether the pollServer should be woken up.
|
func (pd *pollDesc) Evict() {
|
||||||
func (pd *pollDesc) Evict() bool {
|
|
||||||
if pd.runtimeCtx == 0 {
|
if pd.runtimeCtx == 0 {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
runtime_pollUnblock(pd.runtimeCtx)
|
runtime_pollUnblock(pd.runtimeCtx)
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pd *pollDesc) Prepare(mode int) error {
|
func (pd *pollDesc) Prepare(mode int) error {
|
||||||
|
@ -187,9 +187,7 @@ func (fd *netFD) writeUnlock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fd *netFD) Close() error {
|
func (fd *netFD) Close() error {
|
||||||
fd.pd.Lock() // needed for both fd.incref(true) and pollDesc.Evict
|
|
||||||
if !fd.fdmu.IncrefAndClose() {
|
if !fd.fdmu.IncrefAndClose() {
|
||||||
fd.pd.Unlock()
|
|
||||||
return errClosing
|
return errClosing
|
||||||
}
|
}
|
||||||
// Unblock any I/O. Once it all unblocks and returns,
|
// Unblock any I/O. Once it all unblocks and returns,
|
||||||
@ -197,12 +195,8 @@ func (fd *netFD) Close() error {
|
|||||||
// the final decref will close fd.sysfd. This should happen
|
// the final decref will close fd.sysfd. This should happen
|
||||||
// fairly quickly, since all the I/O is non-blocking, and any
|
// fairly quickly, since all the I/O is non-blocking, and any
|
||||||
// attempts to block in the pollDesc will return errClosing.
|
// attempts to block in the pollDesc will return errClosing.
|
||||||
doWakeup := fd.pd.Evict()
|
fd.pd.Evict()
|
||||||
fd.pd.Unlock()
|
|
||||||
fd.decref()
|
fd.decref()
|
||||||
if doWakeup {
|
|
||||||
fd.pd.Wakeup()
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user