带1个vCPU的pool.map

时间:2019-10-07 17:59:27

标签: python python-3.x python-multiprocessing

通过在1个vCPU VPS上运行此代码,将始终打印A。有没有办法确保pool.map对发送给函数的参数进行随机化?

import multiprocessing as mp
import time
import os


def myfunction(mode):
    while True:
        print(mode)


if __name__ == "__main__":
    pool = mp.Pool(None)
    pool.map(
        myfunction,
        [
            "A",
            "B",
            "C",
            "D"
        ],
    )

0 个答案:

没有答案