We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#35 に、Pause/Resumeが実行された際のイベント呼び出し処理を実装します。
stop_if_pause
from typing import Callable type OnPausedCallbackType = Callable[[], None] type OnResumedCallbackType = Callable[[], None] class ControllerCommandHandler: def __init__( self, controller: ReadOnlyController, on_paused_callback: OnPausedCallbackType = lambda : None, on_resumed_callback: OnResumedCallbackType = lambda: None, ): self._controller = controller self.on_paused = on_paused_callback self.on_resumed = on_resumed_callback def stop_if_pause(self, check_resume_interval: float = 1.0) -> None: paused = False if self._controller.is_pause(): self.on_paused() paused = True while not self._controller.wait_for_resume(check_resume_interval) and self._controller.is_active(): # whileの比較順序は変更しないこと (`is_paused`と`wait_for_resume`の実行間隔を最小化。 ) pass if paused: self.on_resumed()
class ThreadEventMixin: def on_paused(self): pass def on_resumed(self): pass
The text was updated successfully, but these errors were encountered:
sugiyama34
No branches or pull requests
タスク内容
#35 に、Pause/Resumeが実行された際のイベント呼び出し処理を実装します。
実装
stop_if_pause
に実装します。スケッチ
イベント処理
Mixin
達成条件
The text was updated successfully, but these errors were encountered: