📜  获取当前工作人员 ID 多处理 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:45.153000             🧑  作者: Mango

代码示例1
import multiprocessing
  
def twos_multiple(x):        
    proc = multiprocessing.Process()
    curr_proc = multiprocessing.current_process()
    print('current process:', curr_proc.name, curr_proc._identity)
    print('created process:', proc.name, proc._identity)
    return x * 2
  
pro = multiprocessing.Pool()
  
print(pro.map(twos_multiple, range(10)))