kopia lustrzana https://github.com/micropython/micropython-lib
select: epoll.poll() takes timeout in seconds.
That's inconsistent with poll.poll(), but that's how CPython has it.pull/216/head
rodzic
61f9dd8721
commit
c8f9cf1dca
|
@ -71,7 +71,7 @@ class Epoll:
|
||||||
os.check_error(r)
|
os.check_error(r)
|
||||||
del self.registry[fd]
|
del self.registry[fd]
|
||||||
|
|
||||||
def poll(self, timeout=-1):
|
def poll_ms(self, timeout=-1):
|
||||||
s = bytearray(self.evbuf)
|
s = bytearray(self.evbuf)
|
||||||
while True:
|
while True:
|
||||||
n = epoll_wait(self.epfd, s, 1, timeout)
|
n = epoll_wait(self.epfd, s, 1, timeout)
|
||||||
|
@ -84,6 +84,9 @@ class Epoll:
|
||||||
res.append((vals[1], vals[0]))
|
res.append((vals[1], vals[0]))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def poll(self, timeout=-1):
|
||||||
|
return self.poll_ms(-1 if timeout == -1 else timeout * 1000)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
os.close(self.epfd)
|
os.close(self.epfd)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue