Overview: Execute task in background, then apppend the future instance in _async_stack. Arguments: - fn (:obj:`Callable`): Synchronization fuction.
(self, fn: Callable, *args, **kwargs)
| 552 | pass |
| 553 | |
| 554 | def async_executor(self, fn: Callable, *args, **kwargs) -> None: |
| 555 | """ |
| 556 | Overview: |
| 557 | Execute task in background, then apppend the future instance in _async_stack. |
| 558 | Arguments: |
| 559 | - fn (:obj:`Callable`): Synchronization fuction. |
| 560 | """ |
| 561 | if not self._async_loop: |
| 562 | raise RuntimeError("Event loop was not initialized, please call this function in async or parallel mode") |
| 563 | t = self._async_loop.run_in_executor(self._thread_pool, fn, *args, **kwargs) |
| 564 | self._async_stack.append(t) |
| 565 | |
| 566 | def wait(self) -> bool: |
| 567 | """Wait for async operations to complete.""" |