Skip to content

Commit 5936daf

Browse files
TaskManager: normal stack size for asyncio thread
1 parent eec5c7c commit 5936daf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal_filesystem/lib/mpos/task_manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import asyncio # this is the only place where asyncio is allowed to be imported - apps should not use it directly but use this TaskManager
22
import _thread
3+
import mpos.apps
34

45
class 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()

0 commit comments

Comments
 (0)