diff options
| -rw-r--r-- | python/qpid/compat.py | 11 | ||||
| -rw-r--r-- | python/qpid/selector.py | 7 |
2 files changed, 12 insertions, 6 deletions
diff --git a/python/qpid/compat.py b/python/qpid/compat.py index 49273193df..53ab757e89 100644 --- a/python/qpid/compat.py +++ b/python/qpid/compat.py @@ -17,6 +17,8 @@ # under the License. # +import sys + try: set = set except NameError: @@ -30,6 +32,13 @@ except ImportError: try: from traceback import format_exc except ImportError: - import sys, traceback + import traceback def format_exc(): return "".join(traceback.format_exception(*sys.exc_info())) + +if tuple(sys.version_info[0:2]) < (2, 4): + from select import select as old_select + def select(rlist, wlist, xlist, timeout=None): + return old_select(list(rlist), list(wlist), list(xlist), timeout) +else: + from select import select diff --git a/python/qpid/selector.py b/python/qpid/selector.py index 05b8d3a203..710f8f0689 100644 --- a/python/qpid/selector.py +++ b/python/qpid/selector.py @@ -17,7 +17,7 @@ # under the License. # import atexit, os, time -from select import select +from compat import select, set from threading import Thread, Lock class Acceptor: @@ -84,10 +84,7 @@ class Selector: self.thread = None def wakeup(self): - while True: - select([], [self.wakeup_fd], []) - if os.write(self.wakeup_fd, "\0") > 0: - break + os.write(self.wakeup_fd, "\0") def register(self, selectable): self.selectables.add(selectable) |
