mirror of https://github.com/tidwall/evio.git
Add a deadline for epollwait
This commit is contained in:
parent
34ff08a426
commit
399d938449
|
@ -54,7 +54,7 @@ func (p *Poll) Trigger(note interface{}) error {
|
||||||
func (p *Poll) Wait(iter func(fd int, note interface{}) error) error {
|
func (p *Poll) Wait(iter func(fd int, note interface{}) error) error {
|
||||||
events := make([]syscall.EpollEvent, 64)
|
events := make([]syscall.EpollEvent, 64)
|
||||||
for {
|
for {
|
||||||
n, err := syscall.EpollWait(p.fd, events, -1)
|
n, err := syscall.EpollWait(p.fd, events, 100)
|
||||||
if err != nil && err != syscall.EINTR {
|
if err != nil && err != syscall.EINTR {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ func (p *Poll) Wait(iter func(fd int, note interface{}) error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else if fd == p.wfd {
|
} else if fd == p.wfd {
|
||||||
var data [16]byte
|
var data [8]byte
|
||||||
syscall.Read(p.wfd, data[:])
|
syscall.Read(p.wfd, data[:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue