mirror of https://github.com/nocturn9x/giambio.git
More TODOS
This commit is contained in:
parent
54c36c08be
commit
e8bef73f36
|
@ -1,6 +1,4 @@
|
||||||
import giambio
|
import giambio
|
||||||
|
|
||||||
|
|
||||||
loop = giambio.EventLoop()
|
loop = giambio.EventLoop()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -42,8 +40,11 @@ async def count(stop, step=1):
|
||||||
async def main():
|
async def main():
|
||||||
print("Spawning countdown immediately, scheduling count for 2 secs from now")
|
print("Spawning countdown immediately, scheduling count for 2 secs from now")
|
||||||
task = loop.spawn(countdown(8))
|
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 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)
|
loop.start(main)
|
||||||
|
|
|
@ -53,6 +53,8 @@ class EventLoop:
|
||||||
self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task
|
self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
self.running.cancelled = True
|
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:
|
except Exception as has_raised:
|
||||||
self.to_run.extend(self.joined.pop(self.running, ())) # Reschedules the parent task
|
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
|
if self.running.joined: # Let the join function handle the hassle of propagating the error
|
||||||
|
|
Loading…
Reference in New Issue