diff --git a/src/crystal/task.py b/src/crystal/task.py index 0f298a33..ff09d8be 100644 --- a/src/crystal/task.py +++ b/src/crystal/task.py @@ -1585,13 +1585,19 @@ def try_get_next_task_unit(self): return super().try_get_next_task_unit() + # === Events === + + @capture_crashes_to(task) def child_task_did_complete(self, task: Task) -> None: task.dispose() + @capture_crashes_to(self) def did_schedule_all_children(self) -> None: # Remove completed children after each scheduling pass self.clear_completed_children() + # === Protected Operations: Finish & Cleanup === + @overrides def clear_children_if_all_complete(self) -> bool: raise NotImplementedError( @@ -1607,6 +1613,8 @@ def fg_task() -> None: # NOTE: Must synchronize access to RootTask.children with foreground thread fg_call_and_wait(fg_task) + # === Public Operations === + def interrupt(self) -> None: """ Stop all descendent tasks, asynchronously, @@ -1614,6 +1622,8 @@ def interrupt(self) -> None: """ self.finish() + # === Utility === + def __repr__(self) -> str: return f''