Fixed dispatcher and registry
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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
|
||||
Reference in New Issue
Block a user