Skip to content
Snippets Groups Projects
Commit 4732ed23 authored by jkerdreu's avatar jkerdreu
Browse files

AsyncioEngine fixes


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2920 b32b6428-25c9-4566-ad07-03861ab6144f
parent 030c520d
Branches main
No related tags found
No related merge requests found
from xaal.aiolib import Engine
from xaal.lib import helpers
from xaal.lib import AsyncEngine,helpers
import functools
helpers.setup_console_logger()
......@@ -7,7 +6,7 @@ helpers.setup_console_logger()
def shutdown(eng):
eng.shutdown()
eng = Engine()
eng = AsyncEngine()
ptr = functools.partial(shutdown,eng)
eng.add_timer(ptr,2)
eng.run()
......@@ -2,10 +2,10 @@
Simple test to study the death the engine with a running thread.
"""
import asyncio
from xaal.aiolib.core import spawn,Engine
from xaal.lib import AsyncEngine,helpers
import time
@spawn
@helpers.spawn
def test1(event):
while not event.is_set():
time.sleep(1)
......@@ -16,7 +16,7 @@ async def test2():
await asyncio.sleep(1)
print('test2')
eng = Engine()
eng = AsyncEngine()
print(eng.new_task(test2()))
ev = asyncio.Event()
......
......@@ -17,5 +17,9 @@ test_func('Bar')
test_func('Baz')
goo = Goo()
goo.test('Goo')
goo.test('Gooz')
try:
# static vars don't work with class methods
goo.test('Goo')
except AttributeError as e:
print(f"AttributeError: {e}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment