通过在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"
],
)