fix a code to terminate process

This commit is contained in:
falsycat 2022-07-13 11:17:07 +09:00
parent a5f951dea9
commit 3d2a454e96

View File

@ -6,15 +6,19 @@ import time
import bitbank
alive = True
def main():
global alive
procs = [*bitbank.init()]
while True:
while alive:
for i in range(len(procs)):
procs[i].tick()
time.sleep(1)
def on_exit(sig, x):
print(f"received {sig}")
global alive
alive = False
proc = multiprocessing.Process(target = main)
proc.start()