Allow switching between poll and epoll.

This commit is contained in:
Merlijn Wajer 2013-05-18 18:52:29 +02:00
parent 7c7abc7e59
commit d3b23386bf
1 changed files with 6 additions and 3 deletions

View File

@ -38,10 +38,13 @@ for idx, f in enumerate(fs):
config.update(c)
poll_obj, poll_mask = (select.poll, select.POLLIN) if args.compat else \
(select.epoll, select.EPOLLIN)
# Add all devices to epoll
pp = select.epoll()
pp = poll_obj()
for f in fs:
pp.register(f.get_fd(), select.EPOLLIN)
pp.register(f.get_fd(), poll_mask)
# Human readable info
@ -70,7 +73,7 @@ while True:
for e in events:
fd, ev_mask = e
if not ev_mask & select.EPOLLIN:
if not ev_mask & poll_mask:
continue
# Lets undo that epoll speedup ;-) FIXME XXX