(self, callback: Callable[[], Any])
| 15489 | self.condition.notify_all() |
| 15490 | |
| 15491 | def call_on_scheduler(self, callback: Callable[[], Any]) -> Any: |
| 15492 | result_box: Dict[str, Any] = {} |
| 15493 | error_box: Dict[str, BaseException] = {} |
| 15494 | done = threading.Event() |
| 15495 | |
| 15496 | def run_callback() -> None: |
| 15497 | try: |
| 15498 | result_box["result"] = callback() |
| 15499 | except BaseException as exc: # noqa: BLE001 |
| 15500 | error_box["error"] = exc |
| 15501 | finally: |
| 15502 | done.set() |
| 15503 | |
| 15504 | self.enqueue(run_callback) |
| 15505 | done.wait() |
| 15506 | if "error" in error_box: |
| 15507 | raise error_box["error"] |
| 15508 | return result_box.get("result") |
| 15509 | |
| 15510 | def call_on_idle_scheduler(self, callback: Callable[[], Any]) -> Any: |
| 15511 | result_box: Dict[str, Any] = {} |
no test coverage detected