Files
rmmanager/createthread.py
T
2026-10-09 03:18:21 -04:00

32 lines
717 B
Python

import threading
from lifecycleregistry import registerLifecycle
from lifecyclemanager import manageLifecycle
activethreads = []
threadnum = 0
def buildThread(module, state, lifecycles):
#for mode in ("continuous", "oneshot")
global threadnum
threadnum += 1
threadname = f"thread.{threadnum}"
thread = threading.Thread(
target=manageLifecycle,
args=(module, state)
)
thread.start()
registryname = threadname
registryvalue = thread
lifecycles = registerLifecycle (module, lifecycles, registryname, registryvalue)
activethreads.append(threadname)
print(activethreads)
print(lifecycles)
return threadnum, threadname, lifecycles, activethreads