[Part of patch #648322] Delete the poll2() function, which uses a 'poll' extension module that was once part of Medusa. Contributed by Kjetil Jacobsen

This commit is contained in:
Andrew M. Kuchling 2003-10-22 14:38:27 +00:00
parent 38afcef3f5
commit 6c2871e707
1 changed files with 4 additions and 29 deletions

View File

@ -125,30 +125,6 @@ def poll(timeout=0.0, map=None):
write(obj)
def poll2(timeout=0.0, map=None):
import poll
if map is None:
map = socket_map
if timeout is not None:
# timeout is in milliseconds
timeout = int(timeout*1000)
if map:
l = []
for fd, obj in map.items():
flags = 0
if obj.readable():
flags = poll.POLLIN
if obj.writable():
flags = flags | poll.POLLOUT
if flags:
l.append((fd, flags))
r = poll.poll(l, timeout)
for fd, flags in r:
obj = map.get(fd)
if obj is None:
continue
readwrite(obj, flags)
def poll3(timeout=0.0, map=None):
# Use the poll() support added to the select module in Python 2.0
if map is None:
map = socket_map
@ -177,14 +153,13 @@ def poll3(timeout=0.0, map=None):
continue
readwrite(obj, flags)
poll3 = poll2 # Alias for backward compatibility
def loop(timeout=30.0, use_poll=0, map=None):
if map is None:
map = socket_map
if use_poll:
if hasattr(select, 'poll'):
poll_fun = poll3
else:
if use_poll and hasattr(select, 'poll'):
poll_fun = poll2
else:
poll_fun = poll