return rv
+# Specialised implementation of wait functions.
+
+
def wait_select(gen: PQGen[RV], fileno: int, timeout: Optional[float] = None) -> RV:
"""
Wait for a generator using select where supported.
return rv
-if selectors.DefaultSelector is getattr(selectors, "EpollSelector", None):
+# Choose the best wait strategy for the platform.
+#
+# the selectors objects have a generic interface but come with some overhead,
+# so we also offer more finely tuned implementations.
+
+if selectors.DefaultSelector is getattr(selectors, "SelectSelector", None):
+ # On Windows, SelectSelector should be the default.
+ wait = wait_select
+
+elif selectors.DefaultSelector is getattr(selectors, "EpollSelector", None):
# NOTE: select seems more performing than epoll. It is admittedly unlikely
# that a platform has epoll but not select, so maybe we could kill
# wait_epoll altogether(). More testing to do.