From e8bef73f36f42decc2eaad3935b8c7385a3e6a4f Mon Sep 17 00:00:00 2001 From: nocturn9x Date: Sat, 21 Mar 2020 12:09:11 +0000 Subject: [PATCH] More TODOS --- experiment.py | 9 +++++---- giambio/core.py | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/experiment.py b/experiment.py index c53f178..a3c3b41 100644 --- a/experiment.py +++ b/experiment.py @@ -1,6 +1,4 @@ import giambio - - loop = giambio.EventLoop() """ @@ -42,8 +40,11 @@ async def count(stop, step=1): async def main(): print("Spawning countdown immediately, scheduling count for 2 secs from now") task = loop.spawn(countdown(8)) - task1 = loop.schedule(count(12, 2), 2) + task1 = loop.schedule(count(8, 2), 2) await giambio.sleep(2) # Wait before cancelling - await task.cancel() # Cancel the task +# await task.cancel() # Cancel the task + result = await task1.join() # Joining multiple tasks still causes problems +# result1 = await task.join() + print("All done") loop.start(main) diff --git a/giambio/core.py b/giambio/core.py index 583a4b6..0e99057 100644 --- a/giambio/core.py +++ b/giambio/core.py @@ -53,6 +53,8 @@ class EventLoop: self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task except RuntimeError: self.running.cancelled = True + self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task + print(self.to_run) except Exception as has_raised: self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task if self.running.joined: # Let the join function handle the hassle of propagating the error