summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/AsynchronousLock.py10
-rw-r--r--pym/_emerge/AsynchronousTask.py2
-rw-r--r--pym/portage/tests/locks/test_asynchronous_lock.py2
3 files changed, 14 insertions, 0 deletions
diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 1135df744..86b102b8b 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -73,6 +73,11 @@ class AsynchronousLock(AsynchronousTask):
if self._imp is not None:
self._imp.cancel()
+ def _poll(self):
+ if self._imp is not None:
+ return self._imp.poll()
+ return self.returncode
+
def _wait(self):
if self.returncode is not None:
return self.returncode
@@ -232,6 +237,11 @@ class _LockProcess(AbstractPollTask):
if self._proc is not None:
self._proc.cancel()
+ def _poll(self):
+ if self._proc is not None:
+ return self._proc.poll()
+ return self.returncode
+
def _wait(self):
if self.returncode is not None:
return self.returncode
diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py
index 2b654ec00..cac1d5594 100644
--- a/pym/_emerge/AsynchronousTask.py
+++ b/pym/_emerge/AsynchronousTask.py
@@ -32,6 +32,8 @@ class AsynchronousTask(SlotObject):
def poll(self):
self._wait_hook()
+ if self.returncode is not None:
+ return self.returncode
return self._poll()
def _poll(self):
diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
index d592f4b22..50b9c93a5 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -56,6 +56,7 @@ class AsynchronousLockTestCase(TestCase):
_force_async=True, _force_process=True)
lock2.start()
# lock2 should we waiting for lock1 to release
+ self.assertEqual(lock2.poll(), None)
self.assertEqual(lock2.returncode, None)
lock1.unlock()
@@ -78,6 +79,7 @@ class AsynchronousLockTestCase(TestCase):
_force_async=True, _force_process=True)
lock2.start()
# lock2 should we waiting for lock1 to release
+ self.assertEqual(lock2.poll(), None)
self.assertEqual(lock2.returncode, None)
# Cancel lock2 and then check wait() and returncode results.