28 lines
364 B
Python
28 lines
364 B
Python
import multiprocessing
|
|
import os
|
|
import signal
|
|
import time
|
|
|
|
import bitbank
|
|
|
|
|
|
alive = True
|
|
|
|
def main():
|
|
global alive
|
|
procs = [*bitbank.init()]
|
|
|
|
cnt = 0
|
|
while alive:
|
|
for i in range(10):
|
|
procs[cnt%len(procs)].tick()
|
|
cnt += 1
|
|
time.sleep(1)
|
|
|
|
def on_exit(sig, x):
|
|
global alive
|
|
alive = False
|
|
|
|
signal.signal(signal.SIGTERM, on_exit)
|
|
main()
|