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
No related branches found
No related tags found
No related merge requests found
from xaal.aiolib import Engine from xaal.lib import AsyncEngine,helpers
from xaal.lib import helpers
import functools import functools
helpers.setup_console_logger() helpers.setup_console_logger()
...@@ -7,7 +6,7 @@ helpers.setup_console_logger() ...@@ -7,7 +6,7 @@ helpers.setup_console_logger()
def shutdown(eng): def shutdown(eng):
eng.shutdown() eng.shutdown()
eng = Engine() eng = AsyncEngine()
ptr = functools.partial(shutdown,eng) ptr = functools.partial(shutdown,eng)
eng.add_timer(ptr,2) eng.add_timer(ptr,2)
eng.run() eng.run()
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
Simple test to study the death the engine with a running thread. Simple test to study the death the engine with a running thread.
""" """
import asyncio import asyncio
from xaal.aiolib.core import spawn,Engine from xaal.lib import AsyncEngine,helpers
import time import time
@spawn @helpers.spawn
def test1(event): def test1(event):
while not event.is_set(): while not event.is_set():
time.sleep(1) time.sleep(1)
...@@ -16,7 +16,7 @@ async def test2(): ...@@ -16,7 +16,7 @@ async def test2():
await asyncio.sleep(1) await asyncio.sleep(1)
print('test2') print('test2')
eng = Engine() eng = AsyncEngine()
print(eng.new_task(test2())) print(eng.new_task(test2()))
ev = asyncio.Event() ev = asyncio.Event()
......
...@@ -17,5 +17,9 @@ test_func('Bar') ...@@ -17,5 +17,9 @@ test_func('Bar')
test_func('Baz') test_func('Baz')
goo = Goo() goo = Goo()
goo.test('Goo') try:
goo.test('Gooz') # 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