示例#1
0
 def schedule_later(self, delay_in_seconds, callback, *args, context=None):
     fut = self._future(func(callback, *args))
     self._scheduled_callback_futures.append(fut)
     self.call_later(delay_in_seconds,
                     fut.set_result,
                     None,
                     context=context)
示例#2
0
 def _future(self, done_hook):
     """
     Create a future object that calls the done_hook when it is awaited
     :param loop:
     :param function:
     :return:
     """
     fut = self.create_future()
     fut.add_done_callback(func(self.unwrapper, function=done_hook))
     return fut
示例#3
0
 def schedule_soon(self, callback, *args, context=None):
     fut = self._future(func(callback, *args))
     self._scheduled_callback_futures.append(fut)
     self.call_soon(fut.set_result, None, context=context)