小编Chr*_*lou的帖子

Python 多处理 - 进程终止(不能启动进程两次)

Can anyone tell me why the following code gives the error "cannot start a process twice"? By my reckoning, p1 and p2 should already have been force-closed by the p.terminate() command

EDIT: Have added in some more code to give context - wanted to come up with a simple example but left out the while loops

import time
import os
from multiprocessing import Process
import datetime

def a():
    print ("a starting")
    time.sleep(30)
    print ("a ending")

def b():
    print ("b starting") …
Run Code Online (Sandbox Code Playgroud)

python multiprocessing python-3.x python-multiprocessing

3
推荐指数
1
解决办法
5790
查看次数