From d3b23386bf30f232fc4091f7db09f64ddc88d6b3 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sat, 18 May 2013 18:52:29 +0200 Subject: [PATCH] Allow switching between poll and epoll. --- input-read | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/input-read b/input-read index 6c99129..643106d 100755 --- a/input-read +++ b/input-read @@ -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