| 230 | self._loop_dispatcher = dispatcher |
| 231 | |
| 232 | def maybe_start(self): |
| 233 | should_start = False |
| 234 | did_acquire = False |
| 235 | try: |
| 236 | did_acquire = self._loop_lock.acquire(False) |
| 237 | if did_acquire and not self._started: |
| 238 | self._started = True |
| 239 | should_start = True |
| 240 | finally: |
| 241 | if did_acquire: |
| 242 | self._loop_lock.release() |
| 243 | |
| 244 | if should_start: |
| 245 | self._thread = Thread(target=self._run_loop, name="asyncore_cassandra_driver_event_loop") |
| 246 | self._thread.daemon = True |
| 247 | self._thread.start() |
| 248 | |
| 249 | def wake_loop(self): |
| 250 | self._loop_dispatcher.notify_loop() |