summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/connection.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-09-09 12:12:21 (GMT)
committerLarry Hastings <larry@hastings.org>2013-09-09 12:12:21 (GMT)
commit8568f66daf088cf235a42288621fb4770ac48199 (patch)
tree3db459417e7c4b112b03d59661057f09ff058d07 /Lib/multiprocessing/connection.py
parent60560b18d29a917e64d88d47c5533743001f0787 (diff)
parent23543ebd8676384c1c5e28f7a1496777a57479d5 (diff)
downloadcpython-8568f66daf088cf235a42288621fb4770ac48199.zip
cpython-8568f66daf088cf235a42288621fb4770ac48199.tar.gz
cpython-8568f66daf088cf235a42288621fb4770ac48199.tar.bz2
Merge.
Diffstat (limited to 'Lib/multiprocessing/connection.py')
-rw-r--r--Lib/multiprocessing/connection.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index 59fb664..27fda9f 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -878,13 +878,21 @@ else:
import selectors
+ # poll/select have the advantage of not requiring any extra file
+ # descriptor, contrarily to epoll/kqueue (also, they require a single
+ # syscall).
+ if hasattr(selectors, 'PollSelector'):
+ _WaitSelector = selectors.PollSelector
+ else:
+ _WaitSelector = selectors.SelectSelector
+
def wait(object_list, timeout=None):
'''
Wait till an object in object_list is ready/readable.
Returns list of those objects in object_list which are ready/readable.
'''
- with selectors.DefaultSelector() as selector:
+ with _WaitSelector() as selector:
for obj in object_list:
selector.register(obj, selectors.EVENT_READ)