]> code.delx.au - bg-scripts/commitdiff
Always use poll
authorJames Bunton <jamesbunton@delx.net.au>
Wed, 12 Nov 2014 05:32:14 +0000 (16:32 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Wed, 12 Nov 2014 05:32:14 +0000 (16:32 +1100)
asyncsched.py

index 5fd8348ff2b3be4ba0a4a6f3a2ec4a9feeb3365e..7edba812adcad893b12ec5bf987877ed5754e19f 100644 (file)
@@ -41,14 +41,6 @@ def loop(timeout=30.0, use_poll=False):
     running = True
     oldhandler = signal.signal(signal.SIGTERM, exit)
 
-    if use_poll:
-        if hasattr(select, 'poll'):
-            poll_fun = asyncore.poll3
-        else:
-            poll_fun = asyncore.poll2
-    else:
-        poll_fun = asyncore.poll
-
     while running:
         now = time.time()
         while tasks and tasks[0].time < now:
@@ -59,7 +51,7 @@ def loop(timeout=30.0, use_poll=False):
         if tasks:
             t = max(min(t, tasks[0].time - now), 0)
 
-        poll_fun(timeout=t)
+        asyncore.poll2(timeout=t)
     
     signal.signal(signal.SIGTERM, oldhandler)