aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/portage/util/_async/AsyncTaskFuture.py')
-rw-r--r--lib/portage/util/_async/AsyncTaskFuture.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/portage/util/_async/AsyncTaskFuture.py b/lib/portage/util/_async/AsyncTaskFuture.py
index 0cd034c97..4c2f7a571 100644
--- a/lib/portage/util/_async/AsyncTaskFuture.py
+++ b/lib/portage/util/_async/AsyncTaskFuture.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2021 Gentoo Foundation
+# Copyright 2018-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import os
@@ -20,6 +20,12 @@ class AsyncTaskFuture(AsynchronousTask):
self.future = asyncio.ensure_future(self.future, self.scheduler)
self.future.add_done_callback(self._done_callback)
+ def isAlive(self):
+ """
+ Returns True if self.future is an asyncio.Future that is not done.
+ """
+ return isinstance(self.future, asyncio.Future) and not self.future.done()
+
def _cancel(self):
if not self.future.done():
self.future.cancel()