Exemplo n.º 1
0
 def __init__(self, task_pool, loop=None):
     """
     :param onedrived.od_task.TaskPool task_pool:
     :param asyncio.SelectorEventLoop | None loop:
     """
     self._lock = threading.RLock()
     self.watch_descriptors = loosebidict()
     self.task_queue = []
     self.task_pool = task_pool
     self.notifier = _INotify()
     if loop is None:
         import asyncio
         self.loop = asyncio.get_event_loop()
     else:
         self.loop = loop
     self.loop.add_reader(self.notifier.fd, self.process_events)
Exemplo n.º 2
0
 def __init__(self, task_pool, loop=None):
     """
     :param onedrived.od_task.TaskPool task_pool:
     :param asyncio.SelectorEventLoop | None loop:
     """
     self._lock = threading.RLock()
     self.watch_descriptors = loosebidict()
     self.task_queue = []
     self.task_pool = task_pool
     self.notifier = _INotify()
     if loop is None:
         import asyncio
         self.loop = asyncio.get_event_loop()
     else:
         self.loop = loop
     self.loop.add_reader(self.notifier.fd, self.process_events)