fix a code to terminate process
This commit is contained in:
parent
a5f951dea9
commit
3d2a454e96
8
main.py
8
main.py
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user