(self)
| 50 | class LibevLoop(object): |
| 51 | |
| 52 | def __init__(self): |
| 53 | self._pid = os.getpid() |
| 54 | self._loop = libev.Loop() |
| 55 | self._notifier = libev.Async(self._loop) |
| 56 | self._notifier.start() |
| 57 | |
| 58 | # prevent _notifier from keeping the loop from returning |
| 59 | self._loop.unref() |
| 60 | |
| 61 | self._started = False |
| 62 | self._shutdown = False |
| 63 | self._lock = Lock() |
| 64 | self._lock_thread = Lock() |
| 65 | |
| 66 | self._thread = None |
| 67 | |
| 68 | # set of all connections; only replaced with a new copy |
| 69 | # while holding _conn_set_lock, never modified in place |
| 70 | self._live_conns = set() |
| 71 | # newly created connections that need their write/read watcher started |
| 72 | self._new_conns = set() |
| 73 | # recently closed connections that need their write/read watcher stopped |
| 74 | self._closed_conns = set() |
| 75 | self._conn_set_lock = Lock() |
| 76 | |
| 77 | self._preparer = libev.Prepare(self._loop, self._loop_will_run) |
| 78 | # prevent _preparer from keeping the loop from returning |
| 79 | self._loop.unref() |
| 80 | self._preparer.start() |
| 81 | |
| 82 | self._timers = TimerManager() |
| 83 | self._loop_timer = libev.Timer(self._loop, self._on_loop_timer) |
| 84 | |
| 85 | def maybe_start(self): |
| 86 | should_start = False |
no test coverage detected