| Conditions | 1 |
| Total Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import asyncio |
||
| 12 | def __init__(self, loop=None, max_workers=None, on_stop_callback=None): |
||
| 13 | self._on_stop_callback = on_stop_callback |
||
| 14 | self._loop = loop or asyncio.get_event_loop() |
||
| 15 | |||
| 16 | # XXX: See https://github.com/python/asyncio/issues/258 |
||
| 17 | # The minimum value depends on the number of cores in the machine |
||
| 18 | # See https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor |
||
| 19 | self._executor = ThreadPoolExecutor(max_workers) |
||
| 20 | self._loop.set_default_executor(self._executor) |
||
| 21 | |||
| 45 |