#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
__title__ = '线程池测试'

@Time    : 2020/9/27 13:57
@Author  : zhengwangeng
@Software: PyCharm

# code is far away from bugs with the god animal protecting
    I love animals. They taste delicious.
              ┏┓      ┏┓
            ┏┛┻━━━┛┻┓
            ┃      ☃      ┃
            ┃  ┳┛  ┗┳  ┃
            ┃      ┻      ┃
            ┗━┓      ┏━┛
                ┃      ┗━━━┓
                ┃  神兽保佑    ┣┓
                ┃ 永无BUG!   ┏┛
                ┗┓┓┏━┳┓┏┛
                  ┃┫┫  ┃┫┫
                  ┗┻┛  ┗┻┛
"""

import os
import random
import time
from concurrent.futures import ProcessPoolExecutor


def task(n):
    print('%s is runing' % os.getpid())
    time.sleep(random.randint(1, 3))
    return n


if __name__ == '__main__':
    print((100 - 1) // 100 + 1)
    print((101 - 1) // 100 + 1)
    for i in range((6 - 1) // 100 + 1):
        print(i, ' == i')
    for j in range((101 - 1) // 100 + 1):
        print(j, ' == j')

    executor = ProcessPoolExecutor(max_workers=3)

    futures = []
    for i in range(11):
        future = executor.submit(task, i)
        futures.append(future)
    executor.shutdown(True)
    print('+++>')
    for future in futures:
        print(future.result())