File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
internal_filesystem/lib/mpos Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11import asyncio # this is the only place where asyncio is allowed to be imported - apps should not use it directly but use this TaskManager
22import _thread
3+ import mpos .apps
34
45class TaskManager :
56
67 task_list = [] # might be good to periodically remove tasks that are done, to prevent this list from growing huge
78
89 def __init__ (self ):
910 print ("TaskManager starting asyncio_thread" )
10- _thread .stack_size (1024 ) # tiny stack size is enough for this simple thread
11+ _thread .stack_size (mpos . apps . good_stack_size ()) # tiny stack size of 1024 is fine for tasks that do nothing but for real-world usage, it needs more
1112 _thread .start_new_thread (asyncio .run , (self ._asyncio_thread (), ))
1213
1314 async def _asyncio_thread (self ):
@@ -33,3 +34,7 @@ def sleep_ms(ms):
3334 @staticmethod
3435 def sleep (s ):
3536 return asyncio .sleep (s )
37+
38+ @staticmethod
39+ def notify_event ():
40+ return asyncio .Event ()
You can’t perform that action at this time.
0 commit comments