File: selectors.py

package info (click to toggle)
python-eventlet 0.40.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,200 kB
  • sloc: python: 25,101; sh: 78; makefile: 31
file content (34 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys

from eventlet import patcher
from eventlet.green import select

__patched__ = [
    'DefaultSelector',
    'SelectSelector',
]

# We only have green select so the options are:
# * leave it be and have selectors that block
# * try to pretend the "bad" selectors don't exist
# * replace all with SelectSelector for the price of possibly different
#   performance characteristic and missing fileno() method (if someone
#   uses it it'll result in a crash, we may want to implement it in the future)
#
# This module used to follow the third approach but just removing the offending
# selectors is less error prone and less confusing approach.
__deleted__ = [
    'PollSelector',
    'EpollSelector',
    'DevpollSelector',
    'KqueueSelector',
]

patcher.inject('selectors', globals(), ('select', select))

del patcher

if sys.platform != 'win32':
    SelectSelector._select = staticmethod(select.select)

DefaultSelector = SelectSelector