import concurrent.futures as cf
import time

def main():
    main_count = 0
    sub_count = 0
    executor = cf.ThreadPoolExecutor(max_workers=2)
    future = executor.submit(sub_thread, main_count)
    time.sleep(0.1# メインスレッドとサブスレッドのタイミングをずらす
    try:
        while True:
            print("{0}メインスレッド".format(main_count))
            main_count += 1
            # サブスレッド終了時の処理
            if future.done():
                print(future.result())
                sub_count += 1
                future = executor.submit(sub_thread, sub_count)
            time.sleep(1)
    except KeyboardInterrupt:
        pass

def sub_thread(arg):
    print("{0}サブスレッド開始".format(arg))
    time.sleep(5)
    return "{0} サブスレット終了".format(arg)

if __name__ == "__main__":
    main()