Handle interrupt on epoll_wait graciously (allows strace to work)
This commit is contained in:
parent
d60d007281
commit
f56dcd1505
1 changed files with 5 additions and 1 deletions
|
|
@ -146,7 +146,11 @@ elif defined(linux):
|
||||||
## on the ``fd``.
|
## on the ``fd``.
|
||||||
result = @[]
|
result = @[]
|
||||||
let evNum = epoll_wait(s.epollFD, addr s.events[0], 64.cint, timeout.cint)
|
let evNum = epoll_wait(s.epollFD, addr s.events[0], 64.cint, timeout.cint)
|
||||||
if evNum < 0: raiseOSError(osLastError())
|
if evNum < 0:
|
||||||
|
let err = osLastError()
|
||||||
|
if err.cint == EINTR:
|
||||||
|
return @[]
|
||||||
|
raiseOSError(osLastError())
|
||||||
if evNum == 0: return @[]
|
if evNum == 0: return @[]
|
||||||
for i in 0 .. <evNum:
|
for i in 0 .. <evNum:
|
||||||
let fd = s.events[i].data.fd.SocketHandle
|
let fd = s.events[i].data.fd.SocketHandle
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue