36 lines
734 B
Python
36 lines
734 B
Python
import threading
|
|
from .lifecyclemanager import registerLifecycle
|
|
from .lifecyclemanager import manageLifecycle
|
|
|
|
threadlist = []
|
|
threadnum = 0
|
|
|
|
def buildThread(module, lifecycles):
|
|
global threadnum
|
|
threadnum += 1
|
|
|
|
threadname = f"thread.{threadnum}"
|
|
|
|
thread = threading.Thread(
|
|
target=manageLifecycle,
|
|
args=(module, lifecycles),
|
|
name=module.name
|
|
)
|
|
|
|
thread.start()
|
|
|
|
#registryname = threadname
|
|
#registryvalue = thread
|
|
|
|
registryname = thread.name
|
|
registryvalue = thread.native_id
|
|
|
|
lifecycles = registerLifecycle (module, lifecycles, registryname, registryvalue)
|
|
|
|
threadlist.append(thread)
|
|
|
|
#print(threadlist)
|
|
#print(lifecycles)
|
|
|
|
return thread, lifecycles
|