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 {
|
||||
events := make([]syscall.EpollEvent, 64)
|
||||
for {
|
||||
n, err := syscall.EpollWait(p.fd, events, -1)
|
||||
n, err := syscall.EpollWait(p.fd, events, 100)
|
||||
if err != nil && err != syscall.EINTR {
|
||||
return err
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func (p *Poll) Wait(iter func(fd int, note interface{}) error) error {
|
|||
return err
|
||||
}
|
||||
} else if fd == p.wfd {
|
||||
var data [16]byte
|
||||
var data [8]byte
|
||||
syscall.Read(p.wfd, data[:])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue